diff mbox series

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

Message ID 20200707202505.2757267-1-yonglel@google.com
State Superseded
Headers show
Series [FFmpeg-devel] libavutil/video_enc_params: add block type | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Yongle Lin July 7, 2020, 8:25 p.m. UTC
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(+)

Comments

Lynne July 7, 2020, 9:09 p.m. UTC | #1
Jul 7, 2020, 21:25 by yongle.lin.94@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.
Yongle Lin July 7, 2020, 9:47 p.m. UTC | #2
On Tue, Jul 7, 2020 at 2:09 PM Lynne <dev@lynne.ee> wrote:

> Jul 7, 2020, 21:25 by yongle.lin.94@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.
>
Thank you so much for the suggestion. It makes much more sense. I will
change the patch accordingly.

> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox series

Patch

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;
+
+    /**
+     * Reference frames used for prediction
+     */
+     uint8_t ref[8];
 } AVVideoBlockParams;
 
 /*