[FFmpeg-devel] [PATCH] swscale/output: don't leave the alpha channel undefined in vuyx and xv36le
Timo Rothenpieler
timo at rothenpieler.org
Tue Aug 13 18:08:53 EEST 2024
On 13/08/2024 16:25, James Almer wrote:
> It's non-determistic, as shown by poisoning avfilter buffers instead of zeroing them.
>
> Signed-off-by: James Almer <jamrial at gmail.com>
> ---
> libswscale/output.c | 6 +++---
> tests/ref/fate/filter-pixfmts-copy | 4 ++--
> tests/ref/fate/filter-pixfmts-crop | 4 ++--
> tests/ref/fate/filter-pixfmts-field | 4 ++--
> tests/ref/fate/filter-pixfmts-fieldorder | 4 ++--
> tests/ref/fate/filter-pixfmts-hflip | 4 ++--
> tests/ref/fate/filter-pixfmts-il | 4 ++--
> tests/ref/fate/filter-pixfmts-null | 4 ++--
> tests/ref/fate/filter-pixfmts-pad | 2 +-
> tests/ref/fate/filter-pixfmts-scale | 4 ++--
> tests/ref/fate/filter-pixfmts-transpose | 4 ++--
> tests/ref/fate/filter-pixfmts-vflip | 4 ++--
> 12 files changed, 24 insertions(+), 24 deletions(-)
>
> diff --git a/libswscale/output.c b/libswscale/output.c
> index e8dd2145ce..fb21e79f47 100644
> --- a/libswscale/output.c
> +++ b/libswscale/output.c
> @@ -2650,7 +2650,7 @@ yuv2xv36le_X_c(SwsContext *c, const int16_t *lumFilter,
> {
> int i;
> for (i = 0; i < dstW; i++) {
> - int Y = 1 << 14, U = 1 << 14, V = 1 << 14;
> + int Y = 1 << 14, U = 1 << 14, V = 1 << 14, A = 255;
> int j;
>
> for (j = 0; j < lumFilterSize; j++)
> @@ -2664,6 +2664,7 @@ yuv2xv36le_X_c(SwsContext *c, const int16_t *lumFilter,
> AV_WL16(dest + 8 * i + 2, av_clip_uintp2(Y >> 15, 12) << 4);
> AV_WL16(dest + 8 * i + 0, av_clip_uintp2(U >> 15, 12) << 4);
> AV_WL16(dest + 8 * i + 4, av_clip_uintp2(V >> 15, 12) << 4);
> + AV_WL16(dest + 8 * i + 6, A);
> }
> }
>
> @@ -2718,8 +2719,7 @@ yuv2vuyX_X_c(SwsContext *c, const int16_t *lumFilter,
> dest[4 * i ] = V;
> dest[4 * i + 1] = U;
> dest[4 * i + 2] = Y;
> - if (destHasAlpha)
> - dest[4 * i + 3] = A;
> + dest[4 * i + 3] = A;
Couldn't this in theory break reading of existing files that rely on
their random data in the alpha channel not being read?
As in, if !destHasAlpha, shouldn't it rather be set to a safe default
value, i.e. 255?
> }
> }
>
> diff --git a/tests/ref/fate/filter-pixfmts-copy b/tests/ref/fate/filter-pixfmts-copy
> index eb3e61b4f2..120129dc1e 100644
> --- a/tests/ref/fate/filter-pixfmts-copy
> +++ b/tests/ref/fate/filter-pixfmts-copy
> @@ -98,11 +98,11 @@ rgba64be ae2ae04b5efedca3505f47c4dd6ea6ea
> rgba64le b91e1d77f799eb92241a2d2d28437b15
> uyvy422 3bcf3c80047592f2211fae3260b1b65d
> vuya 3d5e934651cae1ce334001cb1829ad22
> -vuyx 3f68ea6ec492b30d867cb5401562264e
> +vuyx 0af13a42f9d0932c5a9bb6a8a5d1c5ee
> x2bgr10le 550c0d190cf695afa4eaacb644db6b75
> x2rgb10le c1e3ac21be04a16bb157b22784524520
> xv30le c14b5a953bf3be56346f66ca174a5b1b
> -xv36le 3f8ced42a081639a39ec5929dd77b017
> +xv36le 6b8e46832aa8537a774e93dd7503c700
> xyz12be a1ef56bf746d71f59669c28e48fc8450
> xyz12le 831ff03c1ba4ef19374686f16a064d8c
> y210le 0736b017e0814daf38d3350c42796f7a
> diff --git a/tests/ref/fate/filter-pixfmts-crop b/tests/ref/fate/filter-pixfmts-crop
> index 01cb88bc54..4731e96fc0 100644
> --- a/tests/ref/fate/filter-pixfmts-crop
> +++ b/tests/ref/fate/filter-pixfmts-crop
> @@ -95,11 +95,11 @@ rgba 9488ac85abceaf99a9309eac5a87697e
> rgba64be 89910046972ab3c68e2a348302cc8ca9
> rgba64le fea8ebfc869b52adf353778f29eac7a7
> vuya 76578a705ff3a37559653c1289bd03dd
> -vuyx 5d2bae51a2f4892bd5f177f190cc323b
> +vuyx 615241c5406eb556fca0ad8606c23a02
> x2bgr10le 84de725b85662c362862820dc4a309aa
> x2rgb10le f4265aca7a67dbfa9354370098ca6f33
> xv30le a9edb820819b900a4a897fee4562a4fb
> -xv36le 90a187adf00a1b15c33d064ae2582804
> +xv36le 567af630bf0209e026e0909b3ca9c436
> xyz12be cb4571f9aaa7b59f999ef327276104b7
> xyz12le cd6aae8d26b18bdb4b9d068586276d91
> ya16be a3d18014454942a96f15a49947c0c55d
> diff --git a/tests/ref/fate/filter-pixfmts-field b/tests/ref/fate/filter-pixfmts-field
> index c7d9b8f133..0727d733f2 100644
> --- a/tests/ref/fate/filter-pixfmts-field
> +++ b/tests/ref/fate/filter-pixfmts-field
> @@ -98,11 +98,11 @@ rgba64be 23c8c0edaabe3eaec89ce69633fb0048
> rgba64le dfdba4de4a7cac9abf08852666c341d3
> uyvy422 1c49e44ab3f060e85fc4a3a9464f045e
> vuya f72bcf29d75cd143d0c565f7cc49119a
> -vuyx 6257cd1ce11330660e9fa9c675acbdcc
> +vuyx 3d02eeab336d0a8106f6fdd91be61073
> x2bgr10le dbe21538d7cb1744914f6bd46ec09b55
> x2rgb10le a18bc4ae5274e0a8cca9137ecd50c677
> xv30le e940366c78efc9e292e9de28cf04dba9
> -xv36le aa5a867879a70e1040dfafe3e03167d5
> +xv36le e05a99fc3edc8f26cb2dbd287c0a0fcf
> xyz12be d2fa69ec91d3ed862f2dac3f8e7a3437
> xyz12le 02bccd5e0b6824779a1f848b0ea3e3b5
> y210le 025beb25f047a762e3788dbea4b60864
> diff --git a/tests/ref/fate/filter-pixfmts-fieldorder b/tests/ref/fate/filter-pixfmts-fieldorder
> index 2f64bd3b14..1d7a98ce11 100644
> --- a/tests/ref/fate/filter-pixfmts-fieldorder
> +++ b/tests/ref/fate/filter-pixfmts-fieldorder
> @@ -87,11 +87,11 @@ rgba64be 5598f44514d122b9a57c5c92c20bbc61
> rgba64le b34e6e30621ae579519a2d91a96a0acf
> uyvy422 75de70e31c435dde878002d3f22b238a
> vuya a3891d4168ff208948fd0b3ba0910495
> -vuyx d7a900e970c9a69ed41f8b220114b9fa
> +vuyx 9e4480c5fcb7c091ec3e517420764ef3
> x2bgr10le 86474d84f26c5c51d6f75bf7e1de8da8
> x2rgb10le cdf6a9e8a8d081aa768c6ae2e6221676
> xv30le 25aac48128d94010a3660839500caee5
> -xv36le 1bde4bee8b938d7bf20e75bc848e4765
> +xv36le 1f054a1ba4c8f8875ffd15d3d1baccba
> xyz12be 15f5cda71de5fef9cec5e75e3833b6bc
> xyz12le 7be6c8781f38c21a6b8f602f62ca31e6
> y210le ee45acfb1386288af98af5313162ff3e
> diff --git a/tests/ref/fate/filter-pixfmts-hflip b/tests/ref/fate/filter-pixfmts-hflip
> index 66274890a7..43404db154 100644
> --- a/tests/ref/fate/filter-pixfmts-hflip
> +++ b/tests/ref/fate/filter-pixfmts-hflip
> @@ -95,11 +95,11 @@ rgba 51961c723ea6707e0a410cd3f21f15d3
> rgba64be c910444019f4cfbf4d995227af55da8d
> rgba64le 0c810d8b3a6bca10321788e1cb145340
> vuya 7e530261e7ac4eae4fd616fd7572d0b8
> -vuyx 3ce9890363cad3984521293be1eb679c
> +vuyx f1d087284fb1556d76e6def5f94bf273
> x2bgr10le 827cc659f29378e00c5a7d2c0ada8f9a
> x2rgb10le d4a8189b65395a88d0a38a7053f3359f
> xv30le 072aa2b61ce1e764f9d1957e8abee9a9
> -xv36le cc569285784e38a489f4a286598f05da
> +xv36le 6e9c3d2334f9fe2a0e6156615e53e272
> xyz12be 25f90259ff8a226befdaec3dfe82996e
> xyz12le 926c0791d59aaff61b2778e8ada3316d
> ya16be d5b342355bdd9e3197e01b13b7c6301e
> diff --git a/tests/ref/fate/filter-pixfmts-il b/tests/ref/fate/filter-pixfmts-il
> index 03519f2a9d..4a6f15f074 100644
> --- a/tests/ref/fate/filter-pixfmts-il
> +++ b/tests/ref/fate/filter-pixfmts-il
> @@ -97,11 +97,11 @@ rgba64be db70d33aa6c06f3e0a1c77bd11284261
> rgba64le a8a2daae04374a27219bc1c890204007
> uyvy422 d6ee3ca43356d08c392382b24b22cda5
> vuya b9deab5ba249dd608b709c09255a4932
> -vuyx 49cc92fcc002ec0f312017014dd68c0c
> +vuyx 4251d94ee49e6a3cc1c10c09cd331308
> x2bgr10le 135acaff8318cf9861bb0f7849a9e5e9
> x2rgb10le 517fb186f523dc7cdc5c5c6967cfbe94
> xv30le 7f6414a3fc700380025c29812e8376a9
> -xv36le 066378fad80e34bc3edd22f657be6ff8
> +xv36le cfebfdccb16087207bab0b1909c9d85c
> xyz12be 7c7d54c55f136cbbc50b18029f3be0b3
> xyz12le 090ba6b1170baf2b1358b43b971d33b0
> y210le 306ec4238b49dbc8625a97b678ea1c5f
> diff --git a/tests/ref/fate/filter-pixfmts-null b/tests/ref/fate/filter-pixfmts-null
> index eb3e61b4f2..120129dc1e 100644
> --- a/tests/ref/fate/filter-pixfmts-null
> +++ b/tests/ref/fate/filter-pixfmts-null
> @@ -98,11 +98,11 @@ rgba64be ae2ae04b5efedca3505f47c4dd6ea6ea
> rgba64le b91e1d77f799eb92241a2d2d28437b15
> uyvy422 3bcf3c80047592f2211fae3260b1b65d
> vuya 3d5e934651cae1ce334001cb1829ad22
> -vuyx 3f68ea6ec492b30d867cb5401562264e
> +vuyx 0af13a42f9d0932c5a9bb6a8a5d1c5ee
> x2bgr10le 550c0d190cf695afa4eaacb644db6b75
> x2rgb10le c1e3ac21be04a16bb157b22784524520
> xv30le c14b5a953bf3be56346f66ca174a5b1b
> -xv36le 3f8ced42a081639a39ec5929dd77b017
> +xv36le 6b8e46832aa8537a774e93dd7503c700
> xyz12be a1ef56bf746d71f59669c28e48fc8450
> xyz12le 831ff03c1ba4ef19374686f16a064d8c
> y210le 0736b017e0814daf38d3350c42796f7a
> diff --git a/tests/ref/fate/filter-pixfmts-pad b/tests/ref/fate/filter-pixfmts-pad
> index 73ae9d0f96..abf4fceb46 100644
> --- a/tests/ref/fate/filter-pixfmts-pad
> +++ b/tests/ref/fate/filter-pixfmts-pad
> @@ -42,7 +42,7 @@ rgb24 17f9e2e0c609009acaf2175c42d4a2a5
> rgb48le ed08db9b1aa50d69b8c3d73db93e390e
> rgba b157c90191463d34fb3ce77b36c96386
> vuya 44368c0a758ee68e24ce976e3b1b8535
> -vuyx bc7c4f693a22cd1ac95e33d473086474
> +vuyx ff637b205b78ee581e393124d0f44f5d
> ya16le dfc900a8130a7c5e64201557cbaef50a
> ya8 5d25e9a7975805d3f0dac516a6132b6e
> yuv410p cb871dcc1e84a7ef1d21f9237b88cf6e
> diff --git a/tests/ref/fate/filter-pixfmts-scale b/tests/ref/fate/filter-pixfmts-scale
> index b11384068b..2052d3f2f0 100644
> --- a/tests/ref/fate/filter-pixfmts-scale
> +++ b/tests/ref/fate/filter-pixfmts-scale
> @@ -98,11 +98,11 @@ rgba64be ee73e57923af984b31cc7795d13929da
> rgba64le 783d2779adfafe3548bdb671ec0de69e
> uyvy422 aeb4ba4f9f003ae21f6d18089198244f
> vuya ffa817e283bf6a0b6fba21b07523ccaa
> -vuyx ba182200e20e0c82765eba15217848d3
> +vuyx a6ff68f46c6b4b7595ec91b2a497df8e
> x2bgr10le d57b9a99033cc7b65ddd111578f2d385
> x2rgb10le d56bdb23fa6a8e12a0b4394987f89935
> xv30le afe68d8a47e8460e0164970b1da0c5be
> -xv36le eaf5fbd9d5ea04aeefb40f3d7c2ea289
> +xv36le 4242e35b87fcdfbc3f17370c591577c7
> xyz12be c7ba8345998c0141ddc079cdd29b1a40
> xyz12le 95f5d3a0de834cc495c9032a14987cde
> y210le 1c2708a520477f955d1fedf6ca7a41bd
> diff --git a/tests/ref/fate/filter-pixfmts-transpose b/tests/ref/fate/filter-pixfmts-transpose
> index ec157dee0c..0a395f7e71 100644
> --- a/tests/ref/fate/filter-pixfmts-transpose
> +++ b/tests/ref/fate/filter-pixfmts-transpose
> @@ -87,11 +87,11 @@ rgba 4d76a9542143752a4ac30f82f88f68f1
> rgba64be a60041217f4c0cd796d19d3940a12a41
> rgba64le ad47197774858858ae7b0c177dffa459
> vuya 9ece18a345beb17cd19e09e443eca4bf
> -vuyx 4c2929cd1c6e5512f62e802f482f0ef2
> +vuyx 46b5b821d7ee6ddedb3ddafd1e5b007c
> x2bgr10le 4aa774b6d8f6d446a64f1f288e5c97eb
> x2rgb10le 09cb1d98fe17ad8a6d9d3bec97ddc845
> xv30le b1ac5a12f46d32c70acb63f89838ab76
> -xv36le f15a1d1af2a2967ec6a5efebc87e1ef1
> +xv36le a819ca57db4187a3effe2bd5e374e932
> xyz12be 68e5cba640f6e4ef72dff950e88b5342
> xyz12le 8b6b6a6db4d7561e80db88ccaecce7a9
> ya16be 3e161cb5f225922a80fefdc9cc02a4f9
> diff --git a/tests/ref/fate/filter-pixfmts-vflip b/tests/ref/fate/filter-pixfmts-vflip
> index 9a7972d6cf..5ba28917a7 100644
> --- a/tests/ref/fate/filter-pixfmts-vflip
> +++ b/tests/ref/fate/filter-pixfmts-vflip
> @@ -98,11 +98,11 @@ rgba64be 17e6273323b5779b5f3f775f150c1011
> rgba64le 48f45b10503b7dd140329c3dd0d54c98
> uyvy422 3a237e8376264e0cfa78f8a3fdadec8a
> vuya fb849f76e56181e005c31fce75d7038c
> -vuyx 7a8079a97610e2c1c97aa8832b58a102
> +vuyx ed7de87da324b39090a8961dfd56ca5a
> x2bgr10le 795b66a5fc83cd2cf300aae51c230f80
> x2rgb10le 262c502230cf3724f8e2cf4737f18a42
> xv30le 7e29ee107a1fabf3c7251f337d4b9fe5
> -xv36le aad3c6b5799b4e46a9c9ac27ee7db9bd
> +xv36le bf1cbef0745f90881e15f5c5db3c5949
> xyz12be 810644e008deb231850d779aaa27cc7e
> xyz12le 829701db461b43533cf9241e0743bc61
> y210le 9544c81f8e1fc95e9fa4009dbecfea25
More information about the ffmpeg-devel
mailing list