[FFmpeg-devel] [PATCH 4/6] lavc: APV decoder

James Almer jamrial at gmail.com
Mon Apr 21 17:09:32 EEST 2025


On 4/19/2025 4:07 PM, Mark Thompson wrote:
> ---
>   configure                |   1 +
>   libavcodec/Makefile      |   1 +
>   libavcodec/allcodecs.c   |   1 +
>   libavcodec/apv_decode.c  | 327 +++++++++++++++++++++++++++++++++++++++
>   libavcodec/apv_decode.h  |  80 ++++++++++
>   libavcodec/apv_dsp.c     | 136 ++++++++++++++++
>   libavcodec/apv_dsp.h     |  37 +++++
>   libavcodec/apv_entropy.c | 200 ++++++++++++++++++++++++
>   8 files changed, 783 insertions(+)
>   create mode 100644 libavcodec/apv_decode.c
>   create mode 100644 libavcodec/apv_decode.h
>   create mode 100644 libavcodec/apv_dsp.c
>   create mode 100644 libavcodec/apv_dsp.h
>   create mode 100644 libavcodec/apv_entropy.c
> 
> diff --git a/configure b/configure
> index ca404d2797..ee270b770c 100755
> --- a/configure
> +++ b/configure
> @@ -2935,6 +2935,7 @@ apng_decoder_select="inflate_wrapper"
>   apng_encoder_select="deflate_wrapper llvidencdsp"
>   aptx_encoder_select="audio_frame_queue"
>   aptx_hd_encoder_select="audio_frame_queue"
> +apv_decoder_select="cbs_apv"
>   asv1_decoder_select="blockdsp bswapdsp idctdsp"
>   asv1_encoder_select="aandcttables bswapdsp fdctdsp pixblockdsp"
>   asv2_decoder_select="blockdsp bswapdsp idctdsp"
> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> index a5f5c4e904..e674671460 100644
> --- a/libavcodec/Makefile
> +++ b/libavcodec/Makefile
> @@ -244,6 +244,7 @@ OBJS-$(CONFIG_APTX_HD_DECODER)         += aptxdec.o aptx.o
>   OBJS-$(CONFIG_APTX_HD_ENCODER)         += aptxenc.o aptx.o
>   OBJS-$(CONFIG_APNG_DECODER)            += png.o pngdec.o pngdsp.o
>   OBJS-$(CONFIG_APNG_ENCODER)            += png.o pngenc.o
> +OBJS-$(CONFIG_APV_DECODER)             += apv_decode.o apv_entropy.o apv_dsp.o
>   OBJS-$(CONFIG_ARBC_DECODER)            += arbc.o
>   OBJS-$(CONFIG_ARGO_DECODER)            += argo.o
>   OBJS-$(CONFIG_SSA_DECODER)             += assdec.o ass.o
> diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
> index f10519617e..09f06c71d6 100644
> --- a/libavcodec/allcodecs.c
> +++ b/libavcodec/allcodecs.c
> @@ -47,6 +47,7 @@ extern const FFCodec ff_anm_decoder;
>   extern const FFCodec ff_ansi_decoder;
>   extern const FFCodec ff_apng_encoder;
>   extern const FFCodec ff_apng_decoder;
> +extern const FFCodec ff_apv_decoder;
>   extern const FFCodec ff_arbc_decoder;
>   extern const FFCodec ff_argo_decoder;
>   extern const FFCodec ff_asv1_encoder;
> diff --git a/libavcodec/apv_decode.c b/libavcodec/apv_decode.c
> new file mode 100644
> index 0000000000..066b5a9735
> --- /dev/null
> +++ b/libavcodec/apv_decode.c

[...]

> +static int apv_decode_tile_component(AVCodecContext *avctx, void *data,
> +                                     int job, int thread)
> +{
> +    APVRawFrame                      *input = data;
> +    APVDecodeContext                   *apv = avctx->priv_data;
> +    const CodedBitstreamAPVContext *apv_cbc = apv->cbc->priv_data;
> +    const APVDerivedTileInfo     *tile_info = &apv_cbc->tile_info;
> +
> +    int tile_index = job / apv_cbc->num_comp;
> +    int comp_index = job % apv_cbc->num_comp;
> +
> +    int sub_w = comp_index == 0 ? 1 : apv_cbc->sub_width_c;
> +    int sub_h = comp_index == 0 ? 1 : apv_cbc->sub_height_c;

There's no need for these two in the CBS private context. You can 
achieve the same thing using log2_chroma_w and log2_chroma_h from the 
AVPixFmtDescriptor for the pixel format.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 495 bytes
Desc: OpenPGP digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20250421/81efadd8/attachment.sig>


More information about the ffmpeg-devel mailing list