* [PATCH 0/3] media: uapi: h264: clarify expected scaling list order
@ 2019-10-28 23:59 Jonas Karlman
2019-10-29 0:00 ` [PATCH 1/3] media: uapi: h264: clarify expected scaling_list_4x4/8x8 order Jonas Karlman
[not found] ` <20191029000033.13540-1-jonas@kwiboo.se>
0 siblings, 2 replies; 7+ messages in thread
From: Jonas Karlman @ 2019-10-28 23:59 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Ezequiel Garcia, Maxime Ripard, Paul Kocialkowski
Cc: Jonas Karlman, Hans Verkuil, Jernej Skrabec, Boris Brezillon,
Tomasz Figa, Alexandre Courbot, Nicolas Dufresne, Philipp Zabel,
linux-media, linux-kernel
This is a suggested clarification on the expect order of lists and values
to use in the H264 scaling matrix ctrl, cedrus and hantro currently expect
values in two different orders.
The suggestion is to use the same value order that vaapi, vdpau and nvdec use,
i.e. have the scaling list values in "matrix order"/"raster order",
after the inverse scanning process has been applied.
This also contains a clarification on the order of the scaling lists.
Expected scaling list order will be,
for 4x4: Intra Y, Intra Cb, Intra Cr, Inter Y, Inter Cb, Inter Cr,
for 8x8: Intra Y, Inter Y, Intra Cb, Inter Cb, Intra Cr, Inter Cr.
This series is based on feedback and discussion of [1]
[1] https://patchwork.linuxtv.org/patch/58525/
Jonas Karlman (3):
media: uapi: h264: clarify expected scaling_list_4x4/8x8 order
media: cedrus: Use correct H264 8x8 scaling list
media: hantro: Do not reorder H264 scaling list
.../media/uapi/v4l/ext-ctrls-codec.rst | 8 ++-
drivers/staging/media/hantro/hantro_h264.c | 51 +++++--------------
.../staging/media/sunxi/cedrus/cedrus_h264.c | 4 +-
3 files changed, 20 insertions(+), 43 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH 1/3] media: uapi: h264: clarify expected scaling_list_4x4/8x8 order 2019-10-28 23:59 [PATCH 0/3] media: uapi: h264: clarify expected scaling list order Jonas Karlman @ 2019-10-29 0:00 ` Jonas Karlman 2019-10-29 11:22 ` Philipp Zabel [not found] ` <20191029000033.13540-1-jonas@kwiboo.se> 1 sibling, 1 reply; 7+ messages in thread From: Jonas Karlman @ 2019-10-29 0:00 UTC (permalink / raw) To: Mauro Carvalho Chehab, Ezequiel Garcia, Maxime Ripard, Paul Kocialkowski Cc: Jonas Karlman, Hans Verkuil, Jernej Skrabec, Boris Brezillon, Tomasz Figa, Alexandre Courbot, Nicolas Dufresne, Philipp Zabel, linux-media, linux-kernel Clarify that the expected order of scaling lists should follow the order they are listed in the H264 standard. The expected scaling list order, for 4x4: Intra Y, Intra Cb, Intra Cr, Inter Y, Inter Cb, Inter Cr, for 8x8: Intra Y, Inter Y, Intra Cb, Inter Cb, Intra Cr, Inter Cr. Also clarify that the values in a scaling list should be in matrix order, the same value order that vaapi, vdpau and nvdec use. Signed-off-by: Jonas Karlman <jonas@kwiboo.se> --- Documentation/media/uapi/v4l/ext-ctrls-codec.rst | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Documentation/media/uapi/v4l/ext-ctrls-codec.rst b/Documentation/media/uapi/v4l/ext-ctrls-codec.rst index a1209f68c5e8..28313c0f4e7c 100644 --- a/Documentation/media/uapi/v4l/ext-ctrls-codec.rst +++ b/Documentation/media/uapi/v4l/ext-ctrls-codec.rst @@ -1713,10 +1713,14 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type - * - __u8 - ``scaling_list_4x4[6][16]`` - - + - Scaling matrix after applying the inverse scanning process. + Expected list order is Intra Y, Intra Cb, Intra Cr, Inter Y, + Inter Cb, Inter Cr. * - __u8 - ``scaling_list_8x8[6][64]`` - - + - Scaling matrix after applying the inverse scanning process. + Expected list order is Intra Y, Inter Y, Intra Cb, Inter Cb, + Intra Cr, Inter Cr. ``V4L2_CID_MPEG_VIDEO_H264_SLICE_PARAMS (struct)`` Specifies the slice parameters (as extracted from the bitstream) -- 2.17.1 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] media: uapi: h264: clarify expected scaling_list_4x4/8x8 order 2019-10-29 0:00 ` [PATCH 1/3] media: uapi: h264: clarify expected scaling_list_4x4/8x8 order Jonas Karlman @ 2019-10-29 11:22 ` Philipp Zabel 0 siblings, 0 replies; 7+ messages in thread From: Philipp Zabel @ 2019-10-29 11:22 UTC (permalink / raw) To: Jonas Karlman, Mauro Carvalho Chehab, Ezequiel Garcia, Maxime Ripard, Paul Kocialkowski Cc: Hans Verkuil, Jernej Skrabec, Boris Brezillon, Tomasz Figa, Alexandre Courbot, Nicolas Dufresne, linux-media, linux-kernel On Tue, 2019-10-29 at 00:00 +0000, Jonas Karlman wrote: > Clarify that the expected order of scaling lists should follow the order > they are listed in the H264 standard. > > The expected scaling list order, > for 4x4: Intra Y, Intra Cb, Intra Cr, Inter Y, Inter Cb, Inter Cr, > for 8x8: Intra Y, Inter Y, Intra Cb, Inter Cb, Intra Cr, Inter Cr. > > Also clarify that the values in a scaling list should be in matrix order, > the same value order that vaapi, vdpau and nvdec use. > > Signed-off-by: Jonas Karlman <jonas@kwiboo.se> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> regards Philipp ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <20191029000033.13540-1-jonas@kwiboo.se>]
* [PATCH 2/3] media: cedrus: Use correct H264 8x8 scaling list [not found] ` <20191029000033.13540-1-jonas@kwiboo.se> @ 2019-10-29 0:00 ` Jonas Karlman 2019-10-29 11:22 ` Philipp Zabel 2019-10-29 0:00 ` [PATCH v2 3/3] media: hantro: Do not reorder H264 " Jonas Karlman 1 sibling, 1 reply; 7+ messages in thread From: Jonas Karlman @ 2019-10-29 0:00 UTC (permalink / raw) To: Mauro Carvalho Chehab, Ezequiel Garcia, Maxime Ripard, Paul Kocialkowski Cc: Jonas Karlman, Hans Verkuil, Jernej Skrabec, Boris Brezillon, Tomasz Figa, Alexandre Courbot, Nicolas Dufresne, Philipp Zabel, linux-media, linux-kernel Documentation now define the expected order of scaling lists, change to use correct indices. Fixes: 6eb9b758e307 ("media: cedrus: Add H264 decoding support") Signed-off-by: Jonas Karlman <jonas@kwiboo.se> --- drivers/staging/media/sunxi/cedrus/cedrus_h264.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c index cd85668f9c80..f08cc0d4079e 100644 --- a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c +++ b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c @@ -240,8 +240,8 @@ static void cedrus_write_scaling_lists(struct cedrus_ctx *ctx, sizeof(scaling->scaling_list_8x8[0])); cedrus_h264_write_sram(dev, CEDRUS_SRAM_H264_SCALING_LIST_8x8_1, - scaling->scaling_list_8x8[3], - sizeof(scaling->scaling_list_8x8[3])); + scaling->scaling_list_8x8[1], + sizeof(scaling->scaling_list_8x8[1])); cedrus_h264_write_sram(dev, CEDRUS_SRAM_H264_SCALING_LIST_4x4, scaling->scaling_list_4x4, -- 2.17.1 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/3] media: cedrus: Use correct H264 8x8 scaling list 2019-10-29 0:00 ` [PATCH 2/3] media: cedrus: Use correct H264 8x8 scaling list Jonas Karlman @ 2019-10-29 11:22 ` Philipp Zabel 0 siblings, 0 replies; 7+ messages in thread From: Philipp Zabel @ 2019-10-29 11:22 UTC (permalink / raw) To: Jonas Karlman, Mauro Carvalho Chehab, Ezequiel Garcia, Maxime Ripard, Paul Kocialkowski Cc: Hans Verkuil, Jernej Skrabec, Boris Brezillon, Tomasz Figa, Alexandre Courbot, Nicolas Dufresne, linux-media, linux-kernel On Tue, 2019-10-29 at 00:00 +0000, Jonas Karlman wrote: > Documentation now define the expected order of scaling lists, > change to use correct indices. > > Fixes: 6eb9b758e307 ("media: cedrus: Add H264 decoding support") > Signed-off-by: Jonas Karlman <jonas@kwiboo.se> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> regards Philipp ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 3/3] media: hantro: Do not reorder H264 scaling list [not found] ` <20191029000033.13540-1-jonas@kwiboo.se> 2019-10-29 0:00 ` [PATCH 2/3] media: cedrus: Use correct H264 8x8 scaling list Jonas Karlman @ 2019-10-29 0:00 ` Jonas Karlman 2019-10-29 11:22 ` Philipp Zabel 1 sibling, 1 reply; 7+ messages in thread From: Jonas Karlman @ 2019-10-29 0:00 UTC (permalink / raw) To: Mauro Carvalho Chehab, Ezequiel Garcia, Maxime Ripard, Paul Kocialkowski Cc: Jonas Karlman, Hans Verkuil, Jernej Skrabec, Boris Brezillon, Tomasz Figa, Alexandre Courbot, Nicolas Dufresne, Philipp Zabel, linux-media, linux-kernel Scaling list supplied from userspace should be in matrix order and can be used without applying the inverse scanning process. The HW also only support 8x8 scaling list for the Y component, indices 0 and 1 in the scaling list supplied from userspace. Remove reordering and write the scaling matrix in an order expected by the VPU, also only allocate memory for the two 8x8 lists supported. Fixes: a9471e25629b ("media: hantro: Add core bits to support H264 decoding") Signed-off-by: Jonas Karlman <jonas@kwiboo.se> --- Changes in v2: - use swab32() (Philipp) --- drivers/staging/media/hantro/hantro_h264.c | 51 +++++----------------- 1 file changed, 12 insertions(+), 39 deletions(-) diff --git a/drivers/staging/media/hantro/hantro_h264.c b/drivers/staging/media/hantro/hantro_h264.c index 02cbe7761769..694a330f508e 100644 --- a/drivers/staging/media/hantro/hantro_h264.c +++ b/drivers/staging/media/hantro/hantro_h264.c @@ -20,7 +20,7 @@ /* Size with u32 units. */ #define CABAC_INIT_BUFFER_SIZE (460 * 2) #define POC_BUFFER_SIZE 34 -#define SCALING_LIST_SIZE (6 * 16 + 6 * 64) +#define SCALING_LIST_SIZE (6 * 16 + 2 * 64) #define HANTRO_CMP(a, b) ((a) < (b) ? -1 : 1) @@ -194,23 +194,6 @@ static const u32 h264_cabac_table[] = { 0x1f0c2517, 0x1f261440 }; -/* - * NOTE: The scaling lists are in zig-zag order, apply inverse scanning process - * to get the values in matrix order. In addition, the hardware requires bytes - * swapped within each subsequent 4 bytes. Both arrays below include both - * transformations. - */ -static const u32 zig_zag_4x4[] = { - 3, 2, 7, 11, 6, 1, 0, 5, 10, 15, 14, 9, 4, 8, 13, 12 -}; - -static const u32 zig_zag_8x8[] = { - 3, 2, 11, 19, 10, 1, 0, 9, 18, 27, 35, 26, 17, 8, 7, 6, - 15, 16, 25, 34, 43, 51, 42, 33, 24, 23, 14, 5, 4, 13, 22, 31, - 32, 41, 50, 59, 58, 49, 40, 39, 30, 21, 12, 20, 29, 38, 47, 48, - 57, 56, 55, 46, 37, 28, 36, 45, 54, 63, 62, 53, 44, 52, 61, 60 -}; - static void reorder_scaling_list(struct hantro_ctx *ctx) { @@ -218,33 +201,23 @@ reorder_scaling_list(struct hantro_ctx *ctx) const struct v4l2_ctrl_h264_scaling_matrix *scaling = ctrls->scaling; const size_t num_list_4x4 = ARRAY_SIZE(scaling->scaling_list_4x4); const size_t list_len_4x4 = ARRAY_SIZE(scaling->scaling_list_4x4[0]); - const size_t num_list_8x8 = ARRAY_SIZE(scaling->scaling_list_8x8); const size_t list_len_8x8 = ARRAY_SIZE(scaling->scaling_list_8x8[0]); struct hantro_h264_dec_priv_tbl *tbl = ctx->h264_dec.priv.cpu; - u8 *dst = tbl->scaling_list; - const u8 *src; + u32 *dst = (u32 *)tbl->scaling_list; + const u32 *src; int i, j; - BUILD_BUG_ON(ARRAY_SIZE(zig_zag_4x4) != list_len_4x4); - BUILD_BUG_ON(ARRAY_SIZE(zig_zag_8x8) != list_len_8x8); - BUILD_BUG_ON(ARRAY_SIZE(tbl->scaling_list) != - num_list_4x4 * list_len_4x4 + - num_list_8x8 * list_len_8x8); - - src = &scaling->scaling_list_4x4[0][0]; - for (i = 0; i < num_list_4x4; ++i) { - for (j = 0; j < list_len_4x4; ++j) - dst[zig_zag_4x4[j]] = src[j]; - src += list_len_4x4; - dst += list_len_4x4; + for (i = 0; i < num_list_4x4; i++) { + src = (u32 *)&scaling->scaling_list_4x4[i]; + for (j = 0; j < list_len_4x4 / 4; j++) + *dst++ = swab32(src[j]); } - src = &scaling->scaling_list_8x8[0][0]; - for (i = 0; i < num_list_8x8; ++i) { - for (j = 0; j < list_len_8x8; ++j) - dst[zig_zag_8x8[j]] = src[j]; - src += list_len_8x8; - dst += list_len_8x8; + /* Only Intra/Inter Y lists */ + for (i = 0; i < 2; i++) { + src = (u32 *)&scaling->scaling_list_8x8[i]; + for (j = 0; j < list_len_8x8 / 4; j++) + *dst++ = swab32(src[j]); } } -- 2.17.1 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 3/3] media: hantro: Do not reorder H264 scaling list 2019-10-29 0:00 ` [PATCH v2 3/3] media: hantro: Do not reorder H264 " Jonas Karlman @ 2019-10-29 11:22 ` Philipp Zabel 0 siblings, 0 replies; 7+ messages in thread From: Philipp Zabel @ 2019-10-29 11:22 UTC (permalink / raw) To: Jonas Karlman, Mauro Carvalho Chehab, Ezequiel Garcia, Maxime Ripard, Paul Kocialkowski Cc: Hans Verkuil, Jernej Skrabec, Boris Brezillon, Tomasz Figa, Alexandre Courbot, Nicolas Dufresne, linux-media, linux-kernel On Tue, 2019-10-29 at 00:00 +0000, Jonas Karlman wrote: > Scaling list supplied from userspace should be in matrix order > and can be used without applying the inverse scanning process. > > The HW also only support 8x8 scaling list for the Y component, indices 0 > and 1 in the scaling list supplied from userspace. > > Remove reordering and write the scaling matrix in an order expected by > the VPU, also only allocate memory for the two 8x8 lists supported. > > Fixes: a9471e25629b ("media: hantro: Add core bits to support H264 decoding") > Signed-off-by: Jonas Karlman <jonas@kwiboo.se> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> regards Philipp ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-10-29 11:22 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-28 23:59 [PATCH 0/3] media: uapi: h264: clarify expected scaling list order Jonas Karlman
2019-10-29 0:00 ` [PATCH 1/3] media: uapi: h264: clarify expected scaling_list_4x4/8x8 order Jonas Karlman
2019-10-29 11:22 ` Philipp Zabel
[not found] ` <20191029000033.13540-1-jonas@kwiboo.se>
2019-10-29 0:00 ` [PATCH 2/3] media: cedrus: Use correct H264 8x8 scaling list Jonas Karlman
2019-10-29 11:22 ` Philipp Zabel
2019-10-29 0:00 ` [PATCH v2 3/3] media: hantro: Do not reorder H264 " Jonas Karlman
2019-10-29 11:22 ` Philipp Zabel
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®