[FFmpeg-cvslog] avfilter/vf_minterpolate: rename chroma log vars

Davinder Singh git at videolan.org
Fri Sep 2 14:17:25 EEST 2016


ffmpeg | branch: master | Davinder Singh <ds.mudhar at gmail.com> | Tue Aug 30 06:32:09 2016 +0530| [367577dbe267e71d69f80ec3241ff8e3db0ad6c6] | committer: Paul B Mahol

avfilter/vf_minterpolate: rename chroma log vars

also use AVPixFmtDescriptor instead of avcodec_get_chroma_sub_sample()
for log2_chroma*.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=367577dbe267e71d69f80ec3241ff8e3db0ad6c6
---

 libavfilter/vf_minterpolate.c | 22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/libavfilter/vf_minterpolate.c b/libavfilter/vf_minterpolate.c
index 76a546f..4bb5853 100644
--- a/libavfilter/vf_minterpolate.c
+++ b/libavfilter/vf_minterpolate.c
@@ -184,10 +184,8 @@ typedef struct MIContext {
     double prev_mafd;
     double scd_threshold;
 
-    int chroma_height;
-    int chroma_width;
-    int chroma_h_shift;
-    int chroma_v_shift;
+    int log2_chroma_w;
+    int log2_chroma_h;
     int nb_planes;
 } MIContext;
 
@@ -335,10 +333,8 @@ static int config_input(AVFilterLink *inlink)
     const int width  = inlink->w;
     int i;
 
-    mi_ctx->chroma_height = AV_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
-    mi_ctx->chroma_width = AV_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w);
-
-    avcodec_get_chroma_sub_sample(inlink->format, &mi_ctx->chroma_h_shift, &mi_ctx->chroma_v_shift);
+    mi_ctx->log2_chroma_h = desc->log2_chroma_h;
+    mi_ctx->log2_chroma_w = desc->log2_chroma_w;
 
     mi_ctx->nb_planes = av_pix_fmt_count_planes(inlink->format);
 
@@ -936,8 +932,8 @@ static void set_frame_data(MIContext *mi_ctx, int alpha, AVFrame *avf_out)
                 for (i = 0; i < pixel->nb; i++) {
                     Frame *frame = &mi_ctx->frames[pixel->refs[i]];
                     if (chroma) {
-                        x_mv = (x >> mi_ctx->chroma_h_shift) + (pixel->mvs[i][0] / (1 << mi_ctx->chroma_h_shift));
-                        y_mv = (y >> mi_ctx->chroma_v_shift) + (pixel->mvs[i][1] / (1 << mi_ctx->chroma_v_shift));
+                        x_mv = (x >> mi_ctx->log2_chroma_w) + pixel->mvs[i][0] / (1 << mi_ctx->log2_chroma_w);
+                        y_mv = (y >> mi_ctx->log2_chroma_h) + pixel->mvs[i][1] / (1 << mi_ctx->log2_chroma_h);
                     } else {
                         x_mv = x + pixel->mvs[i][0];
                         y_mv = y + pixel->mvs[i][1];
@@ -949,7 +945,7 @@ static void set_frame_data(MIContext *mi_ctx, int alpha, AVFrame *avf_out)
                 val = ROUNDED_DIV(val, weight_sum);
 
                 if (chroma)
-                    avf_out->data[plane][(x >> mi_ctx->chroma_h_shift) + (y >> mi_ctx->chroma_v_shift) * avf_out->linesize[plane]] = val;
+                    avf_out->data[plane][(x >> mi_ctx->log2_chroma_w) + (y >> mi_ctx->log2_chroma_h) * avf_out->linesize[plane]] = val;
                 else
                     avf_out->data[plane][x + y * avf_out->linesize[plane]] = val;
             }
@@ -1092,8 +1088,8 @@ static void interpolate(AVFilterLink *inlink, AVFrame *avf_out)
                 int height = avf_out->height;
 
                 if (plane == 1 || plane == 2) {
-                    width = mi_ctx->chroma_width;
-                    height = mi_ctx->chroma_height;
+                    width = AV_CEIL_RSHIFT(width, mi_ctx->log2_chroma_w);
+                    height = AV_CEIL_RSHIFT(height, mi_ctx->log2_chroma_h);
                 }
 
                 for (y = 0; y < height; y++) {



More information about the ffmpeg-cvslog mailing list