From: Jonas Karlman <jonas@kwiboo.se>
To: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Cc: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>,
Detlev Casanova <detlev.casanova@collabora.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Heiko Stuebner <heiko@sntech.de>, Alex Bee <knaerzche@gmail.com>,
Sebastian Fricke <sebastian.fricke@collabora.com>,
linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org,
devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/7] media: rkvdec: Add HEVC backend
Date: Mon, 11 Aug 2025 21:46:42 +0200 [thread overview]
Message-ID: <d0d50da8-f8bb-4a6f-bd44-5199d26b7a86@kwiboo.se> (raw)
In-Reply-To: <9c8cb837d10d3cdd54fe34dedfe40c10e848f648.camel@collabora.com>
Hi Nicolas,
On 8/11/2025 9:12 PM, Nicolas Dufresne wrote:
> Le dimanche 10 août 2025 à 21:24 +0000, Jonas Karlman a écrit :
>> The Rockchip VDEC supports the HEVC codec with the Main and Main10
>> Profile up to Level 5.1 High tier: 4096x2304@60 fps.
>>
>> Add the backend for HEVC format to the decoder.
>>
>> Signed-off-by: Alex Bee <knaerzche@gmail.com>
>> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
>> Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com>
>> Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
>> ---
>> Changes in v2:
>> - Use new_value in transpose_and_flatten_matrices()
>> - Add NULL check for ctrl->new_elems in rkvdec_hevc_run_preamble()
>> - Set RKVDEC_WR_DDR_ALIGN_EN for RK3328
>> ---
>> .../media/platform/rockchip/rkvdec/Makefile | 2 +-
>> .../rockchip/rkvdec/rkvdec-hevc-data.c | 1848 +++++++++++++++++
>> .../platform/rockchip/rkvdec/rkvdec-hevc.c | 817 ++++++++
>> .../platform/rockchip/rkvdec/rkvdec-regs.h | 2 +
>> .../media/platform/rockchip/rkvdec/rkvdec.c | 76 +
>> .../media/platform/rockchip/rkvdec/rkvdec.h | 1 +
>> 6 files changed, 2745 insertions(+), 1 deletion(-)
>> create mode 100644 drivers/media/platform/rockchip/rkvdec/rkvdec-hevc-data.c
>> create mode 100644 drivers/media/platform/rockchip/rkvdec/rkvdec-hevc.c
>>
>> diff --git a/drivers/media/platform/rockchip/rkvdec/Makefile
>> b/drivers/media/platform/rockchip/rkvdec/Makefile
>> index cb86b429cfaa..a77122641d14 100644
>> --- a/drivers/media/platform/rockchip/rkvdec/Makefile
>> +++ b/drivers/media/platform/rockchip/rkvdec/Makefile
>> @@ -1,3 +1,3 @@
>> obj-$(CONFIG_VIDEO_ROCKCHIP_VDEC) += rockchip-vdec.o
>>
>> -rockchip-vdec-y += rkvdec.o rkvdec-h264.o rkvdec-vp9.o
>> +rockchip-vdec-y += rkvdec.o rkvdec-h264.o rkvdec-hevc.o rkvdec-vp9.o
>> diff --git a/drivers/media/platform/rockchip/rkvdec/rkvdec-hevc-data.c
>> b/drivers/media/platform/rockchip/rkvdec/rkvdec-hevc-data.c
>> new file mode 100644
>> index 000000000000..eac4ea604949
>> --- /dev/null
>> +++ b/drivers/media/platform/rockchip/rkvdec/rkvdec-hevc-data.c
>> @@ -0,0 +1,1848 @@
>> +// SPDX-License-Identifier: GPL-2.0
>> +/*
>> + * Rockchip Video Decoder driver
>> + *
>> + * Copyright (C) 2023 Collabora, Ltd.
>> + * Sebastian Fricke <sebastian.fricke@collabora.com>
>> + */
>> +
>> +#include <linux/types.h>
>> +
>> +#define RKV_CABAC_TABLE_SIZE 27456
>> +
>> +/*
>> + * This file is #include from rkvdec-hevc.c and not compiled.
>> + */
>> +static const u8 rkvdec_hevc_cabac_table[RKV_CABAC_TABLE_SIZE] = {
>> + 0x07, 0x0f, 0x48, 0x58, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x0f,
>> 0x40, 0x40, 0x40, 0x0f,
>
> Nit, in H.264 case, we managed to fill the CABAC based on the spect with macros,
> didn't we figure-out this one ? I didn't check in Detlev tree, I'm just asking
> here.
As hinted at in the cover letter: in the initial implementation used for
LibreELEC I just shamelessly copied the cabac data 1:1 from the Rockchip
mpp library, for this series it was replaced with the cabac table from
Sebastian Fricke prior series to add a HEVC backend [1]. Sebastian
mentioned following regarding the cabac table:
"""
Notable design decisions:
- The giant static array of cabac values is moved to a separate c file,
I did so because a separate .h file would be incorrect as it doesn't
expose anything of any value for any other file than the rkvdec-hevc.c
file. Other options were:
- Calculating the values instead of storing the results (No clear pattern
found for the calculation using the static array and the formulas from the
specification)
- Supply them via firmware (Adding firmware makes the whole software
way more complicated and the usage of the driver less obvious)
"""
I have not explored any other way to handle the cabac table based on
these design decisions.
[1] https://lore.kernel.org/linux-media/20230101-patch-series-v2-6-2-rc1-v2-0-fa1897efac14@collabora.com/
Regards,
Jonas
>
> Nicolas
[snip]
next prev parent reply other threads:[~2025-08-11 19:47 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-10 21:24 [PATCH v2 0/7] media: rkvdec: Add HEVC backend Jonas Karlman
2025-08-10 21:24 ` [PATCH v2 1/7] " Jonas Karlman
2025-08-11 19:12 ` Nicolas Dufresne
2025-08-11 19:46 ` Jonas Karlman [this message]
2025-08-11 20:27 ` Nicolas Dufresne
2025-08-11 21:07 ` Nicolas Dufresne
2025-08-12 0:58 ` Jonas Karlman
2025-08-12 13:07 ` Nicolas Dufresne
2025-08-12 19:54 ` Detlev Casanova
2025-08-17 16:39 ` Jonas Karlman
2025-08-18 8:25 ` Detlev Casanova
2025-08-12 20:10 ` Detlev Casanova
2025-08-17 16:46 ` Jonas Karlman
2025-08-29 20:22 ` Nicolas Dufresne
2025-09-03 7:28 ` Jonas Karlman
2025-09-03 13:44 ` Nicolas Dufresne
2025-08-10 21:24 ` [PATCH v2 2/7] media: rkvdec: Add variants support Jonas Karlman
2025-08-11 21:11 ` Nicolas Dufresne
2025-08-10 21:24 ` [PATCH v2 3/7] media: rkvdec: Implement capability filtering Jonas Karlman
2025-08-11 21:17 ` Nicolas Dufresne
2025-08-10 21:24 ` [PATCH v2 4/7] media: rkvdec: Add RK3288 variant Jonas Karlman
2025-08-11 21:17 ` Nicolas Dufresne
2025-08-10 21:24 ` [PATCH v2 5/7] media: rkvdec: Disable QoS for HEVC and VP9 on RK3328 Jonas Karlman
2025-08-11 21:25 ` Nicolas Dufresne
2025-08-11 22:22 ` Jonas Karlman
2025-08-12 12:47 ` Nicolas Dufresne
2025-08-11 23:08 ` Jonas Karlman
2025-08-12 13:00 ` Nicolas Dufresne
2025-08-17 16:18 ` Jonas Karlman
2025-08-10 21:24 ` [PATCH v2 6/7] media: dt-bindings: rockchip,vdec: Add RK3288 compatible Jonas Karlman
2025-08-10 21:24 ` [PATCH v2 7/7] ARM: dts: rockchip: Add vdec node for RK3288 Jonas Karlman
2025-08-11 21:52 ` [PATCH v2 0/7] media: rkvdec: Add HEVC backend Nicolas Dufresne
2025-08-12 0:00 ` Jonas Karlman
2025-08-12 12:38 ` Nicolas Dufresne
2025-08-12 12:44 ` Nicolas Dufresne
2025-08-12 17:31 ` Jonas Karlman
2025-08-12 18:26 ` Nicolas Dufresne
2025-08-12 18:52 ` Nicolas Dufresne
2025-08-17 16:33 ` Jonas Karlman
2025-08-12 19:57 ` Detlev Casanova
2025-08-12 21:11 ` Nicolas Dufresne
2025-08-12 12:11 ` Diederik de Haas
2025-08-12 12:55 ` Diederik de Haas
2025-08-12 13:27 ` Nicolas Dufresne
2025-08-12 14:09 ` Diederik de Haas
2025-08-14 21:25 ` Alex Bee
2025-08-12 17:11 ` Jonas Karlman
2025-08-12 18:28 ` Diederik de Haas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d0d50da8-f8bb-4a6f-bd44-5199d26b7a86@kwiboo.se \
--to=jonas@kwiboo.se \
--cc=detlev.casanova@collabora.com \
--cc=devicetree@vger.kernel.org \
--cc=ezequiel@vanguardiasur.com.ar \
--cc=heiko@sntech.de \
--cc=knaerzche@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=mchehab@kernel.org \
--cc=nicolas.dufresne@collabora.com \
--cc=sebastian.fricke@collabora.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).