[FFmpeg-cvslog] intrax8: Keep a reference to the context idctdsp

Vittorio Giovara git at videolan.org
Sun Apr 24 13:30:55 CEST 2016


ffmpeg | branch: master | Vittorio Giovara <vittorio.giovara at gmail.com> | Fri Feb 19 18:12:06 2016 -0500| [68127e1bf8037a6e0acd6401cc8c5da950e3fa0a] | committer: Vittorio Giovara

intrax8: Keep a reference to the context idctdsp

Use it instead of the embedded mpegvideo one. Update init function
signature to load it directly from the callers.

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

 configure            |    1 +
 libavcodec/intrax8.c |   14 ++++++++------
 libavcodec/intrax8.h |    6 +++++-
 libavcodec/vc1dec.c  |    2 +-
 libavcodec/wmv2dec.c |    2 +-
 5 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/configure b/configure
index a68a5d7..99b9405 100755
--- a/configure
+++ b/configure
@@ -1863,6 +1863,7 @@ error_resilience_select="me_cmp"
 faandct_deps="faan fdctdsp"
 faanidct_deps="faan idctdsp"
 h264dsp_select="startcode"
+intrax8_select="idctdsp"
 mdct_select="fft"
 rdft_select="fft"
 me_cmp_select="fdctdsp idctdsp pixblockdsp"
diff --git a/libavcodec/intrax8.c b/libavcodec/intrax8.c
index a1c046e..0082591 100644
--- a/libavcodec/intrax8.c
+++ b/libavcodec/intrax8.c
@@ -492,7 +492,7 @@ static void x8_ac_compensation(IntraX8Context *const w, const int direction,
 {
     MpegEncContext *const s = w->s;
     int t;
-#define B(x, y) s->block[0][s->idsp.idct_permutation[(x) + (y) * 8]]
+#define B(x, y) s->block[0][w->idsp.idct_permutation[(x) + (y) * 8]]
 #define T(x)  ((x) * dc_level + 0x8000) >> 16;
     switch (direction) {
     case 0:
@@ -704,7 +704,7 @@ static int x8_decode_intra_mb(IntraX8Context *const w, const int chroma)
                                                s->current_picture.f->linesize[!!chroma]);
     }
     if (!zeros_only)
-        s->idsp.idct_add(w->dest[chroma],
+        w->idsp.idct_add(w->dest[chroma],
                          s->current_picture.f->linesize[!!chroma],
                          s->block[0]);
 
@@ -743,12 +743,14 @@ static void x8_init_block_index(IntraX8Context *w, AVFrame *frame, int mb_y)
     w->dest[2] += (mb_y & (~1)) * uvlinesize << 2;
 }
 
-av_cold int ff_intrax8_common_init(IntraX8Context *w, MpegEncContext *const s)
+av_cold int ff_intrax8_common_init(IntraX8Context *w, IDCTDSPContext *idsp,
+                                   MpegEncContext *const s)
 {
     int ret = x8_vlc_init();
     if (ret < 0)
         return ret;
 
+    w->idsp = *idsp;
     w->s = s;
 
     // two rows, 2 blocks per cannon mb
@@ -756,11 +758,11 @@ av_cold int ff_intrax8_common_init(IntraX8Context *w, MpegEncContext *const s)
     if (!w->prediction_table)
         return AVERROR(ENOMEM);
 
-    ff_init_scantable(s->idsp.idct_permutation, &w->scantable[0],
+    ff_init_scantable(w->idsp.idct_permutation, &w->scantable[0],
                       ff_wmv1_scantable[0]);
-    ff_init_scantable(s->idsp.idct_permutation, &w->scantable[1],
+    ff_init_scantable(w->idsp.idct_permutation, &w->scantable[1],
                       ff_wmv1_scantable[2]);
-    ff_init_scantable(s->idsp.idct_permutation, &w->scantable[2],
+    ff_init_scantable(w->idsp.idct_permutation, &w->scantable[2],
                       ff_wmv1_scantable[3]);
 
     ff_intrax8dsp_init(&w->dsp);
diff --git a/libavcodec/intrax8.h b/libavcodec/intrax8.h
index e2532f8..ef88d83 100644
--- a/libavcodec/intrax8.h
+++ b/libavcodec/intrax8.h
@@ -21,6 +21,7 @@
 
 #include "get_bits.h"
 #include "mpegvideo.h"
+#include "idctdsp.h"
 #include "intrax8dsp.h"
 
 typedef struct IntraX8Context {
@@ -37,6 +38,7 @@ typedef struct IntraX8Context {
     // set by the caller codec
     MpegEncContext *s;
     IntraX8DSPContext dsp;
+    IDCTDSPContext idsp;
     int quant;
     int dquant;
     int qsum;
@@ -61,10 +63,12 @@ typedef struct IntraX8Context {
  * Initialize IntraX8 frame decoder.
  * Requires valid MpegEncContext with valid s->mb_width before calling.
  * @param w pointer to IntraX8Context
+ * @param idsp pointer to IDCTDSPContext
  * @param s pointer to MpegEncContext of the parent codec
  * @return 0 on success, a negative AVERROR value on error
  */
-int ff_intrax8_common_init(IntraX8Context *w, MpegEncContext *const s);
+int ff_intrax8_common_init(IntraX8Context *w, IDCTDSPContext *idsp,
+                           MpegEncContext *const s);
 
 /**
  * Destroy IntraX8 frame structure.
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index c67fffa..9e64a6b 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -379,7 +379,7 @@ av_cold int ff_vc1_decode_init_alloc_tables(VC1Context *v)
         }
     }
 
-    ret = ff_intrax8_common_init(&v->x8, s);
+    ret = ff_intrax8_common_init(&v->x8, &s->idsp, s);
     if (ret < 0)
         goto error;
 
diff --git a/libavcodec/wmv2dec.c b/libavcodec/wmv2dec.c
index 5bfedbd..03b949e 100644
--- a/libavcodec/wmv2dec.c
+++ b/libavcodec/wmv2dec.c
@@ -471,7 +471,7 @@ static av_cold int wmv2_decode_init(AVCodecContext *avctx)
 
     ff_wmv2_common_init(w);
 
-    return ff_intrax8_common_init(&w->x8, &w->s);
+    return ff_intrax8_common_init(&w->x8, &w->s.idsp, &w->s);
 }
 
 static av_cold int wmv2_decode_end(AVCodecContext *avctx)



More information about the ffmpeg-cvslog mailing list