[FFmpeg-devel] [PATCH] libavcodec/vp9: export block structure when segmentation isn't enable

Yongle Lin yongle.lin.94 at gmail.com
Mon Jul 6 21:30:07 EEST 2020


it makes sense to export block structure like src_x, src_y, width and
height when segmentation isn't enable so we could visualize and see the
structure of the block.
---
 libavcodec/vp9.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
index fd0bab14a2..e700def70e 100644
--- a/libavcodec/vp9.c
+++ b/libavcodec/vp9.c
@@ -1501,10 +1501,8 @@ static int vp9_export_enc_params(VP9Context *s, VP9Frame *frame)
     AVVideoEncParams *par;
     unsigned int tile, nb_blocks = 0;
 
-    if (s->s.h.segmentation.enabled) {
-        for (tile = 0; tile < s->active_tile_cols; tile++)
-            nb_blocks += s->td[tile].nb_block_structure;
-    }
+    for (tile = 0; tile < s->active_tile_cols; tile++)
+        nb_blocks += s->td[tile].nb_block_structure;
 
     par = av_video_enc_params_create_side_data(frame->tf.f,
         AV_VIDEO_ENC_PARAMS_VP9, nb_blocks);
@@ -1536,7 +1534,7 @@ static int vp9_export_enc_params(VP9Context *s, VP9Frame *frame)
                 b->w     = 1 << (3 + td->block_structure[block_tile].block_size_idx_x);
                 b->h     = 1 << (3 + td->block_structure[block_tile].block_size_idx_y);
 
-                if (s->s.h.segmentation.feat[seg_id].q_enabled) {
+                if (s->s.h.segmentation.enabled && s->s.h.segmentation.feat[seg_id].q_enabled) {
                     b->delta_qp = s->s.h.segmentation.feat[seg_id].q_val;
                     if (s->s.h.segmentation.absolute_vals)
                         b->delta_qp -= par->qp;
-- 
2.27.0.383.g050319c2ae-goog



More information about the ffmpeg-devel mailing list