#9077 closed defect (fixed)
Transparency wrong for yuv420 -> rgba on altivec
| Reported by: | pocock | Owned by: | |
|---|---|---|---|
| Priority: | normal | Component: | swscale |
| Version: | git-master | Keywords: | ppc altivec |
| Cc: | Blocked By: | ||
| Blocking: | Reproduced by developer: | yes | |
| Analyzed by developer: | no |
Description
Summary of the bug:
How to reproduce:
ffmpeg -loglevel 48 -i VID_20150419_101911.mp4 -vframes 1 -pix_fmt rgba out.png ffmpeg version 7:4.3.1-5~bpo10+1 with patch from #5570 built on Debian 10 / ppc64le
Discussed in Blender bug tracker
https://developer.blender.org/T80912#1095862
Copy of input file:
https://dev-files.blender.org/file/data/zkoixegxcuagluo2dd33/PHID-FILE-solnqodzm6hk76h4ud2f/VID_20150419_101911.mp4
PNG / Screenshot of broken output:
https://dev-files.blender.org/file/data/2ubaxhcrkusf6udvddh6/PHID-FILE-7izlml2yionqysqn4gma/ffmpeg-out.png
Console output from the ffmpeg command above:
https://dev-files.blender.org/file/download/jhiqfzxxqxqbscaph4of/PHID-FILE-krwaflq6uba7t3qjler6/ffmpeg-test-1.txt
Change History (6)
comment:1 by , 3 years ago
| Summary: | image not rendered, vertical bars missing → image not rendered correctly, vertical bars missing |
|---|
comment:2 by , 3 years ago
| Component: | undetermined → swscale |
|---|---|
| Keywords: | ppc added; cat removed |
| Priority: | important → normal |
| Reproduced by developer: | set |
| Status: | new → open |
| Summary: | image not rendered correctly, vertical bars missing → yuv420 -> rgb32 broken on altivec |
comment:3 by , 3 years ago
| Keywords: | altivec added |
|---|---|
| Summary: | yuv420 -> rgb32 broken on altivec → Transparency wrong for yuv420 -> rgba on altivec |
The current behaviour (transparency broken) is also reproducible with 68363b6989f3355457af90f0c568ccbae9d4deb2 (the fix seems not to work correctly), the output was broken differently before, this brokenness was fixed since, likely #7124.
ffmpeg -f rawvideo -s 320x240 -i out.yuv -pix_fmt rgb32_1 -vframes 1 -y -f image2 out.sgi
FFmpeg version git-68363b6, Copyright (c) 2000-2009 Fabrice Bellard, et al.
configuration: --enable-swscale --enable-gpl --cc=/opt/at12.0/bin/gcc -m32
libavutil 49.15. 0 / 49.15. 0
libavcodec 52.20. 0 / 52.20. 0
libavformat 52.30. 1 / 52.30. 1
libavdevice 52. 1. 0 / 52. 1. 0
libswscale 0. 7. 1 / 0. 7. 1
built on Jan 23 2021 15:48:35, gcc: 8.3.1 20190304 (Advance-Toolchain-at12.0) [revision 269374]
Input #0, rawvideo, from 'out.yuv':
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0.0: Video: rawvideo, yuv420p, 320x240, 25 tbr, 25 tbn, 25 tbc
[swscaler @ 0x10be1d00]ALTIVEC: Color Space RGBA
Output #0, image2, to 'out.sgi':
Stream #0.0: Video: sgi, rgb32_1, 320x240, q=2-31, 200 kb/s, 90k tbn, 25 tbc
Stream mapping:
Stream #0.0 -> #0.0
Press [q] to stop encoding
frame= 1 fps= 0 q=0.0 Lsize= -0kB time=0.04 bitrate= -4.4kbits/s
video:66kB audio:0kB global headers:0kB muxing overhead -100.032543%
comment:4 by , 3 years ago
Feel free to test this change:
diff --git a/libswscale/ppc/yuv2rgb_altivec.c b/libswscale/ppc/yuv2rgb_altivec.c
index 58e480d..eb6b3d7 100644
--- a/libswscale/ppc/yuv2rgb_altivec.c
+++ b/libswscale/ppc/yuv2rgb_altivec.c
@@ -425,13 +425,13 @@ static int altivec_ ## name(SwsContext *c, const unsigned char **in, \
}
#define out_abgr(a, b, c, ptr) \
- vec_mstrgb32(__typeof__(a), ((__typeof__(a)) { 255 }), c, b, a, ptr)
+ vec_mstrgb32(__typeof__(a), ((__typeof__(a)) { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }), c, b, a, ptr)
#define out_bgra(a, b, c, ptr) \
- vec_mstrgb32(__typeof__(a), c, b, a, ((__typeof__(a)) { 255 }), ptr)
+ vec_mstrgb32(__typeof__(a), c, b, a, ((__typeof__(a)) { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }), ptr)
#define out_rgba(a, b, c, ptr) \
- vec_mstrgb32(__typeof__(a), a, b, c, ((__typeof__(a)) { 255 }), ptr)
+ vec_mstrgb32(__typeof__(a), a, b, c, ((__typeof__(a)) { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }), ptr)
#define out_argb(a, b, c, ptr) \
- vec_mstrgb32(__typeof__(a), ((__typeof__(a)) { 255 }), a, b, c, ptr)
+ vec_mstrgb32(__typeof__(a), ((__typeof__(a)) { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }), a, b, c, ptr)
#define out_rgb24(a, b, c, ptr) vec_mstrgb24(a, b, c, ptr)
#define out_bgr24(a, b, c, ptr) vec_mstbgr24(a, b, c, ptr)
comment:5 by , 3 years ago
| Resolution: | → fixed |
|---|---|
| Status: | open → closed |
Should be fixed in 2687070d9b092d3a354a6963c65197054ddf7a75
comment:6 by , 3 years ago
I downloaded the commit as a patch, applied it on 4.3.1 and it fixed the problem for me. Thanks for fixing this so quickly.
Updated the details in the Blender bug too
https://developer.blender.org/T80912#1099699



For future tickets:
Please test current FFmpeg git head, the only version supported on this bug tracker and please always provide all information here on the bug tracker, do not use external resources except for large input files.
Workaround is to convert to rgb24.
$ ffmpeg -f lavfi -i testsrc2 -vframes 1 -pix_fmt rgba out.png ffmpeg version N-100746-gd8a585d Copyright (c) 2000-2021 the FFmpeg developers built with gcc 8.3.1 (GCC) 20190304 (Advance-Toolchain-at12.0) [revision 269374] configuration: --enable-gpl --cc=/opt/at12.0/bin/gcc libavutil 56. 63.101 / 56. 63.101 libavcodec 58.117.101 / 58.117.101 libavformat 58. 65.101 / 58. 65.101 libavdevice 58. 11.103 / 58. 11.103 libavfilter 7. 96.100 / 7. 96.100 libswscale 5. 8.100 / 5. 8.100 libswresample 3. 8.100 / 3. 8.100 libpostproc 55. 8.100 / 55. 8.100 Input #0, lavfi, from 'testsrc2': Duration: N/A, start: 0.000000, bitrate: N/A Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 25 tbr, 25 tbn, 25 tbc Stream mapping: Stream #0:0 -> #0:0 (rawvideo (native) -> png (native)) Press [q] to stop, [?] for help [swscaler @ 0x2c840490] ALTIVEC: Color Space RGBA Output #0, image2, to 'out.png': Metadata: encoder : Lavf58.65.101 Stream #0:0: Video: png, rgba(pc, progressive), 320x240 [SAR 1:1 DAR 4:3], q=2-31, 200 kb/s, 25 fps, 25 tbn Metadata: encoder : Lavc58.117.101 png frame= 1 fps=0.0 q=-0.0 Lsize=N/A time=00:00:00.04 bitrate=N/A speed=0.626x video:10kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknownOutput is visually broken.
On Power6, Power7 etc. this is a regression since 8dcbfb73d58c06fa012db5ffea97647fed95a280