[FFmpeg-devel] [PATCH] libavutil/video_enc_params: add block type

Lynne dev at lynne.ee
Wed Jul 8 00:09:16 EEST 2020


Jul 7, 2020, 21:25 by yongle.lin.94 at gmail.com:

> add block type field to AVVideoBlockParams so we could either export or visualize it later.
> ---
>  libavutil/video_enc_params.h | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
>
> diff --git a/libavutil/video_enc_params.h b/libavutil/video_enc_params.h
> index 43fa443154..bff5354a8d 100644
> --- a/libavutil/video_enc_params.h
> +++ b/libavutil/video_enc_params.h
> @@ -126,6 +126,21 @@ typedef struct AVVideoBlockParams {
>  * corresponding per-frame value.
>  */
>  int32_t delta_qp;
> +
> +    /**
> +     * Type of block
> +     * Each bit field indicates a type flag:
> +     * - (1 << 0) Intra prediction flag for the block
> +     *   1 indicates that prediction type is intra, otherwise inter
> +     * - (1 << 1) Skip flag for the block
> +     *   1 indicates that a block has no residual coefficients, 0 otherwise
> +     */
> +     uint64_t type;
>

You also need to define the flags by an enum or a define.

enum AVVideoBlockFlags { 
    AV_VIDEO_ENC_BLOCK_INTRA = 1ULL <<  0, /* Indicates block uses intraprediction */
    AV_VIDEO_ENC_BLOCK_SKIP = 1ULL <<  1, /* Indicates block is not coded (skipped) */
};

Using 1ULL forces the enum to be 64-bit unsigned, so you can specify it in the struct like:
enum AVVideoBlockFlags flags;
Rather than just a uint64_t.


More information about the ffmpeg-devel mailing list