[FFmpeg-cvslog] Merge commit 'd0540fd02171a6233d2016b199d013299debf7e3'

Derek Buitenhuis git at videolan.org
Sat May 7 22:51:00 CEST 2016


ffmpeg | branch: master | Derek Buitenhuis <derek.buitenhuis at gmail.com> | Sat May  7 21:35:20 2016 +0100| [578fb5a27d4523c958a1907787b659883a2d9b5b] | committer: Derek Buitenhuis

Merge commit 'd0540fd02171a6233d2016b199d013299debf7e3'

* commit 'd0540fd02171a6233d2016b199d013299debf7e3':
  intrax8: Pass macroblock size to ff_intrax8_common_init

Merged-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>

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

 libavcodec/intrax8.c |   20 ++++++++++++--------
 libavcodec/intrax8.h |    7 +++++++
 libavcodec/vc1dec.c  |    4 +++-
 libavcodec/wmv2dec.c |    3 ++-
 4 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/libavcodec/intrax8.c b/libavcodec/intrax8.c
index f6131ee..bd332fa 100644
--- a/libavcodec/intrax8.c
+++ b/libavcodec/intrax8.c
@@ -395,7 +395,7 @@ static void x8_get_prediction_chroma(IntraX8Context *const w)
 
     w->edges  = 1 * (!(s->mb_x >> 1));
     w->edges |= 2 * (!(s->mb_y >> 1));
-    w->edges |= 4 * (s->mb_x >= (2 * s->mb_width - 1)); // mb_x for chroma would always be odd
+    w->edges |= 4 * (s->mb_x >= (2 * w->mb_width - 1)); // mb_x for chroma would always be odd
 
     w->raw_orient = 0;
     // lut_co[8] = {inv,4,8,8, inv,4,8,8} <- => {1,1,0,0;1,1,0,0} => 0xCC
@@ -414,7 +414,7 @@ static void x8_get_prediction(IntraX8Context *const w)
 
     w->edges  = 1 * (!s->mb_x);
     w->edges |= 2 * (!s->mb_y);
-    w->edges |= 4 * (s->mb_x >= (2 * s->mb_width - 1));
+    w->edges |= 4 * (s->mb_x >= (2 * w->mb_width - 1));
 
     switch (w->edges & 3) {
     case 0:
@@ -735,6 +735,7 @@ static void x8_init_block_index(IntraX8Context *w, AVFrame *frame, int mb_y)
 
 av_cold int ff_intrax8_common_init(AVCodecContext *avctx,
                                    IntraX8Context *w, IDCTDSPContext *idsp,
+                                   int mb_width, int mb_height,
                                    MpegEncContext *const s)
 {
     int ret = x8_vlc_init();
@@ -743,10 +744,14 @@ av_cold int ff_intrax8_common_init(AVCodecContext *avctx,
 
     w->avctx = avctx;
     w->idsp = *idsp;
+    s->mb_x = 0;
+    s->mb_y = 0;
+    w->mb_width  = mb_width;
+    w->mb_height = mb_height;
     w->s = s;
 
-    //two rows, 2 blocks per cannon mb
-    w->prediction_table = av_mallocz(s->mb_width * 2 * 2);
+    // two rows, 2 blocks per cannon mb
+    w->prediction_table = av_mallocz(w->mb_width * 2 * 2);
     if (!w->prediction_table)
         return AVERROR(ENOMEM);
 
@@ -798,11 +803,10 @@ int ff_intrax8_decode_picture(IntraX8Context *const w, Picture *pict,
     }
     x8_reset_vlc_tables(w);
 
-    for (s->mb_y = 0; s->mb_y < s->mb_height * 2; s->mb_y++) {
+    for (s->mb_y = 0; s->mb_y < w->mb_height * 2; s->mb_y++) {
         x8_init_block_index(w, w->frame, s->mb_y);
-        mb_xy = (s->mb_y >> 1) * s->mb_stride;
-
-        for (s->mb_x = 0; s->mb_x < s->mb_width * 2; s->mb_x++) {
+        mb_xy = (s->mb_y >> 1) * (w->mb_width + 1);
+        for (s->mb_x = 0; s->mb_x < w->mb_width * 2; s->mb_x++) {
             x8_get_prediction(w);
             if (x8_setup_spatial_predictor(w, 0))
                 goto error;
diff --git a/libavcodec/intrax8.h b/libavcodec/intrax8.h
index ed3dcc6..2f54598 100644
--- a/libavcodec/intrax8.h
+++ b/libavcodec/intrax8.h
@@ -68,6 +68,10 @@ typedef struct IntraX8Context {
     int chroma_orient;
     int orient;
     int est_run;
+
+    // block props
+    int mb_x, mb_y;
+    int mb_width, mb_height;
 } IntraX8Context;
 
 /**
@@ -76,11 +80,14 @@ typedef struct IntraX8Context {
  * @param avctx pointer to AVCodecContext
  * @param w pointer to IntraX8Context
  * @param idsp pointer to IDCTDSPContext
+ * @param mb_width macroblock width
+ * @param mb_height macroblock height
  * @param s pointer to MpegEncContext of the parent codec
  * @return 0 on success, a negative AVERROR value on error
  */
 int ff_intrax8_common_init(AVCodecContext *avctx,
                            IntraX8Context *w, IDCTDSPContext *idsp,
+                           int mb_width, int mb_height,
                            MpegEncContext *const s);
 
 /**
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 786c6db..89996a1 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -387,7 +387,9 @@ av_cold int ff_vc1_decode_init_alloc_tables(VC1Context *v)
                 return AVERROR(ENOMEM);
     }
 
-    ret = ff_intrax8_common_init(s->avctx, &v->x8, &s->idsp, s);
+    ret = ff_intrax8_common_init(s->avctx, &v->x8, &s->idsp,
+                                 s->mb_width, s->mb_height,
+                                 s);
     if (ret < 0)
         goto error;
 
diff --git a/libavcodec/wmv2dec.c b/libavcodec/wmv2dec.c
index 67a06b6..92f7f0b 100644
--- a/libavcodec/wmv2dec.c
+++ b/libavcodec/wmv2dec.c
@@ -468,7 +468,8 @@ static av_cold int wmv2_decode_init(AVCodecContext *avctx)
 
     ff_wmv2_common_init(w);
 
-    return ff_intrax8_common_init(avctx, &w->x8, &w->s.idsp, &w->s);
+    return ff_intrax8_common_init(avctx, &w->x8, &w->s.idsp,
+                                  w->s.mb_width, w->s.mb_height, &w->s);
 }
 
 static av_cold int wmv2_decode_end(AVCodecContext *avctx)


======================================================================

diff --cc libavcodec/vc1dec.c
index 786c6db,d1a99d7..89996a1
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@@ -382,12 -372,16 +382,14 @@@ av_cold int ff_vc1_decode_init_alloc_ta
      v->mv_f_next[1]     = v->mv_f_next[0] + (s->b8_stride * (mb_height * 2 + 1) + s->mb_stride * (mb_height + 1) * 2);
  
      if (s->avctx->codec_id == AV_CODEC_ID_WMV3IMAGE || s->avctx->codec_id == AV_CODEC_ID_VC1IMAGE) {
 -        for (i = 0; i < 4; i++) {
 -            v->sr_rows[i >> 1][i & 1] = av_malloc(v->output_width);
 -            if (!v->sr_rows[i >> 1][i & 1])
 -                goto error;
 -        }
 +        for (i = 0; i < 4; i++)
 +            if (!(v->sr_rows[i >> 1][i & 1] = av_malloc(v->output_width)))
 +                return AVERROR(ENOMEM);
      }
  
-     ret = ff_intrax8_common_init(s->avctx, &v->x8, &s->idsp, s);
+     ret = ff_intrax8_common_init(s->avctx, &v->x8, &s->idsp,
+                                  s->mb_width, s->mb_height,
+                                  s);
      if (ret < 0)
          goto error;
  



More information about the ffmpeg-cvslog mailing list