From 4019c113140ff4841607c84598f2ce5912464f9b Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 9 May 2020 17:57:24 +0200 Subject: video: fix rgb30 component order Was broken with a zimg wrapper refucktor before the previous commit. In addition, it seems this didn't match the vo_drm format, or the format naming convention. So the order actually changes, and the format is redefined. (The img_format.h comment was probably wrong.) Change vo_gpu to the new format as well, so we can still test it. --- test/ref/repack.txt | 2 +- test/repack.c | 3 +++ video/img_format.h | 2 +- video/out/opengl/ra_gl.c | 2 +- video/repack.c | 4 ++-- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/test/ref/repack.txt b/test/ref/repack.txt index 3946a6eb47..3fc8b954f7 100644 --- a/test/ref/repack.txt +++ b/test/ref/repack.txt @@ -87,7 +87,7 @@ pal8 => [un] gbrap | a=1:1 qsv => no rgb0 => [pa] [un] gbrp | a=1:1 [tu] [tp] rgb24 => [pa] [un] gbrp | a=1:1 -rgb30 => [pa] [un] gbrp10 | a=1:1 +rgb30 => [pa] [un] gbrp10 | a=1:1 [tu] [tp] rgb4 => no rgb444 => [pa] [un] gbrp4 | a=1:1 rgb444 => [pa] [un] gbrp | a=1:1 [expand-8bit] diff --git a/test/repack.c b/test/repack.c index ede6046350..1b701fcb4c 100644 --- a/test/repack.c +++ b/test/repack.c @@ -24,6 +24,7 @@ struct entry { #define P8(...) (const uint8_t[]){__VA_ARGS__} #define P16(...) (const uint16_t[]){__VA_ARGS__} +#define P32(...) (const uint32_t[]){__VA_ARGS__} // Warning: only entries that match existing conversions are tested. static const struct entry repack_tests[] = { @@ -52,6 +53,8 @@ static const struct entry repack_tests[] = { {1, 1, -AV_PIX_FMT_RGB48BE, {P16(0x1a1b, 0x2a2b, 0x3a3b)}, -AV_PIX_FMT_GBRP16, {P16(0x2b2a), P16(0x3b3a), P16(0x1b1a)}}, + {1, 1, IMGFMT_RGB30, {P32((3 << 20) | (2 << 10) | 1)}, + -AV_PIX_FMT_GBRP10, {P16(2), P16(1), P16(3)}}, {8, 1, -AV_PIX_FMT_MONOWHITE, {P8(0xAA)}, IMGFMT_Y1, {P8(0, 1, 0, 1, 0, 1, 0, 1)}}, {8, 1, -AV_PIX_FMT_MONOBLACK, {P8(0xAA)}, diff --git a/video/img_format.h b/video/img_format.h index b0fdef8a50..489b0e88db 100644 --- a/video/img_format.h +++ b/video/img_format.h @@ -213,7 +213,7 @@ enum mp_imgfmt { IMGFMT_YAP16, // Accessed with bit-shifts, uint32_t units. - IMGFMT_RGB30, // 2pad 10r 10g 10b (MSG to LSB) + IMGFMT_RGB30, // 2pad 10r 10g 10b (MSB to LSB) // Fringe formats for fringe RGB format repacking. IMGFMT_Y1, // gray with 1 bit per pixel diff --git a/video/out/opengl/ra_gl.c b/video/out/opengl/ra_gl.c index 9b409ccb71..b7deba9fbe 100644 --- a/video/out/opengl/ra_gl.c +++ b/video/out/opengl/ra_gl.c @@ -190,7 +190,7 @@ static int ra_init_gl(struct ra *ra, GL *gl) desc->num_planes = 1; desc->planes[0] = fmt; for (int i = 0; i < 3; i++) - desc->components[0][i] = i + 1; + desc->components[0][i] = 3 - i; desc->chroma_w = desc->chroma_h = 1; } if (strcmp(fmt->name, "appleyp") == 0) { diff --git a/video/repack.c b/video/repack.c index 359e32996d..a2877390da 100644 --- a/video/repack.c +++ b/video/repack.c @@ -234,7 +234,7 @@ PA_WORD_3(pa_ccc8z8, uint32_t, uint8_t, 0, 8, 16, 0) UN_WORD_3(un_x8ccc8, uint32_t, uint8_t, 8, 16, 24, 0xFFu) PA_WORD_3(pa_z8ccc8, uint32_t, uint8_t, 8, 16, 24, 0) UN_WORD_3(un_ccc10x2, uint32_t, uint16_t, 0, 10, 20, 0x3FFu) -PA_WORD_3(pa_ccc10z2, uint32_t, uint16_t, 20, 10, 0, 0) +PA_WORD_3(pa_ccc10z2, uint32_t, uint16_t, 0, 10, 20, 0) #define PA_WORD_2(name, packed_t, plane_t, sh_c0, sh_c1, pad) \ static void name(void *dst, void *src[], int w) { \ @@ -598,7 +598,7 @@ static void setup_misc_packer(struct mp_repack *rp) rp->imgfmt_b = planar_fmt; rp->repack = packed_repack; rp->packed_repack_scanline = rp->pack ? pa_ccc10z2 : un_ccc10x2; - static int c_order[] = {3, 2, 1}; + static int c_order[] = {2, 1, 3}; for (int n = 0; n < 3; n++) rp->components[n] = c_order[n] - 1; } else if (rp->imgfmt_a == IMGFMT_PAL8 && !rp->pack) { -- cgit v1.2.3