diff mbox series

[FFmpeg-devel,1/2] vsrc_testsrc: add support for x2rgb10le to rgbtestsrc

Message ID 20241030132543.726-1-jamrial@gmail.com
State New
Headers show
Series [FFmpeg-devel,1/2] vsrc_testsrc: add support for x2rgb10le to rgbtestsrc | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished

Commit Message

James Almer Oct. 30, 2024, 1:25 p.m. UTC
Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavfilter/vsrc_testsrc.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Michael Niedermayer Nov. 1, 2024, 4:48 p.m. UTC | #1
On Wed, Oct 30, 2024 at 10:25:41AM -0300, James Almer wrote:
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  libavfilter/vsrc_testsrc.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)

mips is unhappy before and after this patch

--- src/tests/ref/fate/filter-pixdesc-x2bgr10le	2024-10-26 22:34:14.532454440 +0200
+++ tests/data/fate/filter-pixdesc-x2bgr10le	2024-11-01 17:45:20.577481969 +0100
@@ -1 +1 @@
-pixdesc-x2bgr10le   0ea287ba7ea42330714e7020f2fde7d0
+pixdesc-x2bgr10le   f9ce2cc71dc00df2c212b68caf181765
Test filter-pixdesc-x2bgr10le failed. Look at tests/data/fate/filter-pixdesc-x2bgr10le.err for details.
make: *** [src/tests/Makefile:315: fate-filter-pixdesc-x2bgr10le] Error 1
make: *** Waiting for unfinished jobs....
--- src/tests/ref/fate/filter-pixdesc-x2rgb10le	2024-10-26 22:34:14.532454440 +0200
+++ tests/data/fate/filter-pixdesc-x2rgb10le	2024-11-01 17:45:20.581481994 +0100
@@ -1 +1 @@
-pixdesc-x2rgb10le   d34a932222b55f4041742b95837b272e
+pixdesc-x2rgb10le   45f6ccc4efa56ae1b38f4741b12e1a75
Test filter-pixdesc-x2rgb10le failed. Look at tests/data/fate/filter-pixdesc-x2rgb10le.err for details.
make: *** [src/tests/Makefile:315: fate-filter-pixdesc-x2rgb10le] Error 1

[...]
James Almer Nov. 1, 2024, 5:01 p.m. UTC | #2
On 11/1/2024 1:48 PM, Michael Niedermayer wrote:
> On Wed, Oct 30, 2024 at 10:25:41AM -0300, James Almer wrote:
>> Signed-off-by: James Almer <jamrial@gmail.com>
>> ---
>>   libavfilter/vsrc_testsrc.c | 11 +++++++++++
>>   1 file changed, 11 insertions(+)
> 
> mips is unhappy before and after this patch
> 
> --- src/tests/ref/fate/filter-pixdesc-x2bgr10le	2024-10-26 22:34:14.532454440 +0200
> +++ tests/data/fate/filter-pixdesc-x2bgr10le	2024-11-01 17:45:20.577481969 +0100
> @@ -1 +1 @@
> -pixdesc-x2bgr10le   0ea287ba7ea42330714e7020f2fde7d0
> +pixdesc-x2bgr10le   f9ce2cc71dc00df2c212b68caf181765
> Test filter-pixdesc-x2bgr10le failed. Look at tests/data/fate/filter-pixdesc-x2bgr10le.err for details.
> make: *** [src/tests/Makefile:315: fate-filter-pixdesc-x2bgr10le] Error 1
> make: *** Waiting for unfinished jobs....
> --- src/tests/ref/fate/filter-pixdesc-x2rgb10le	2024-10-26 22:34:14.532454440 +0200
> +++ tests/data/fate/filter-pixdesc-x2rgb10le	2024-11-01 17:45:20.581481994 +0100
> @@ -1 +1 @@
> -pixdesc-x2rgb10le   d34a932222b55f4041742b95837b272e
> +pixdesc-x2rgb10le   45f6ccc4efa56ae1b38f4741b12e1a75
> Test filter-pixdesc-x2rgb10le failed. Look at tests/data/fate/filter-pixdesc-x2rgb10le.err for details.
> make: *** [src/tests/Makefile:315: fate-filter-pixdesc-x2rgb10le] Error 1

filter-pixdesc tests don't use rgbtestsrc, so how can it change at all?
diff mbox series

Patch

diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c
index e3e076e878..1342f63d25 100644
--- a/libavfilter/vsrc_testsrc.c
+++ b/libavfilter/vsrc_testsrc.c
@@ -996,6 +996,7 @@  static void rgbtest_put_pixel(uint8_t *dstp[4], int dst_linesizep[4],
                               int x, int y, unsigned r, unsigned g, unsigned b, enum AVPixelFormat fmt,
                               uint8_t rgba_map[4])
 {
+    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(fmt);
     uint8_t *dst = dstp[0];
     ptrdiff_t dst_linesize = dst_linesizep[0];
     uint32_t v;
@@ -1023,6 +1024,15 @@  static void rgbtest_put_pixel(uint8_t *dstp[4], int dst_linesizep[4],
         p = dst + 4*x + y*dst_linesize;
         AV_WL32(p, v);
         break;
+    case AV_PIX_FMT_X2RGB10LE:
+    case AV_PIX_FMT_X2BGR10LE:
+        v = (r  << ((desc->comp[0].offset*8) + desc->comp[0].shift)) +
+            (g  << ((desc->comp[1].offset*8) + desc->comp[1].shift)) +
+            (b  << ((desc->comp[2].offset*8) + desc->comp[2].shift)) +
+            (3U << ((desc->comp[3].offset*8) + desc->comp[3].shift));
+        p = dst + 4*x + y*dst_linesize;
+        AV_WL32(p, v);
+        break;
     case AV_PIX_FMT_GBRP:
         p = dstp[0] + x + y * dst_linesize;
         p[0] = g;
@@ -1106,6 +1116,7 @@  static const enum AVPixelFormat rgbtest_pix_fmts[] = {
         AV_PIX_FMT_RGB555, AV_PIX_FMT_BGR555,
         AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRP9, AV_PIX_FMT_GBRP10,
         AV_PIX_FMT_GBRP12, AV_PIX_FMT_GBRP14, AV_PIX_FMT_GBRP16,
+        AV_PIX_FMT_X2RGB10LE, AV_PIX_FMT_X2BGR10LE,
         AV_PIX_FMT_NONE
     };