[FFmpeg-devel] [PATCH 3/4] avcodec/h264dec: implement export of video coding info for H.264

Michael Niedermayer michael at niedermayer.cc
Fri Jul 18 17:17:34 EEST 2025


On Fri, Jul 18, 2025 at 12:30:54PM +0200, Timothée Regaud wrote:
> From: Timothee Regaud <timothee.informatique at regaud-chapuy.fr>
> 
> Hooks into the H.264 decoder to populate the new generic video coding info structures. It handles allocation of the side data buffer, collection of modes/MVs/refs for all macroblock types, and attach the final side data buffer to the output frame.
> 
> This should serve as a template for adding support for other codecs down the line.
> 
> Signed-off-by: Timothee Regaud <timothee.informatique at regaud-chapuy.fr>
> ---
>  Changelog                     |   1 +
>  libavcodec/h264_mb.c          | 150 ++++++++++++++++++++++++++++++++++
>  libavcodec/h264_mb_template.c |   3 +
>  libavcodec/h264_picture.c     |   3 +
>  libavcodec/h264_slice.c       |  19 +++++
>  libavcodec/h264dec.c          |  17 ++++
>  libavcodec/h264dec.h          |  12 +++
>  7 files changed, 205 insertions(+)
> 
[...]
> @@ -102,6 +103,14 @@
>  // does this mb use listX, note does not work if subMBs
>  #define USES_LIST(a, list) ((a) & ((MB_TYPE_P0L0 | MB_TYPE_P1L0) << (2 * (list))))
>  
> +/* Constants for AVVideoCodingInfo buffer allocation for H.264.
> + * Max sub-data per MB is for inter prediction with 16 partitions. */
> +static const size_t H264_MAX_MV_SIZE_PER_LIST = 16 * sizeof(int16_t[2]);
> +static const size_t H264_MAX_REF_SIZE_PER_LIST = 16 * sizeof(int8_t);
> +static const size_t H264_INTER_SUB_DATA_SIZE = 2 * (H264_MAX_MV_SIZE_PER_LIST + H264_MAX_REF_SIZE_PER_LIST);
> +static const size_t H264_INTRA_SUB_DATA_SIZE = 16 * sizeof(int8_t);
> +static const size_t H264_MAX_SUB_DATA_PER_MB = FFMAX(H264_INTER_SUB_DATA_SIZE, H264_INTRA_SUB_DATA_SIZE);

CC	libavfilter/vf_codecview.o
In file included from src/libavfilter/vf_codecview.c:45:0:
src/libavcodec/h264dec.h:110:48: error: initializer element is not constant
 static const size_t H264_INTER_SUB_DATA_SIZE = 2 * (H264_MAX_MV_SIZE_PER_LIST + H264_MAX_REF_SIZE_PER_LIST);
                                                ^
In file included from src/libavutil/error.h:30:0,
                 from src/libavutil/common.h:43,
                 from src/libavutil/avutil.h:300,
                 from src/libavutil/opt.h:31,
                 from src/libavfilter/vf_codecview.c:34:
src/libavutil/macros.h:47:20: error: initializer element is not constant
 #define FFMAX(a,b) ((a) > (b) ? (a) : (b))
                    ^
src/libavcodec/h264dec.h:112:48: note: in expansion of macro ‘FFMAX’
 static const size_t H264_MAX_SUB_DATA_PER_MB = FFMAX(H264_INTER_SUB_DATA_SIZE, H264_INTRA_SUB_DATA_SIZE);

arm-linux-gnueabi-gcc-7 (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04) 7.5.0

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20250718/89c3e423/attachment.sig>


More information about the ffmpeg-devel mailing list