[FFmpeg-devel] [PATCH 2/2] Copy optimized fullpel motion compensation functions from (put|avg)_pixels_tab to other MC function tables, so that optimized versions can be used even if the rest of the functions haven't been optimized

David Conrad lessen42
Tue Feb 9 21:01:48 CET 2010


---
 libavcodec/dsputil.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c
index 2251a69..864b3fb 100644
--- a/libavcodec/dsputil.c
+++ b/libavcodec/dsputil.c
@@ -4895,6 +4895,27 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx)
             c->avg_2tap_qpel_pixels_tab[0][i]= c->avg_h264_qpel_pixels_tab[0][i];
     }
 
+    // all these functions do the same thing, assume _pixels_tab and
+    // _h264_qpel_pixels_tab have the most optimized versions
+#define FPEL_MC(PFX, IDX) \
+    c->PFX ## _no_rnd_pixels_tab[IDX][0] = \
+        c->PFX ## _pixels_tab[IDX][0]; \
+    c->PFX ## _qpel_pixels_tab[IDX][0] = \
+    c->PFX ## _no_rnd_qpel_pixels_tab[IDX][0] = \
+    c->PFX ## _cavs_qpel_pixels_tab[IDX][0] = \
+    c->PFX ## _rv30_tpel_pixels_tab[IDX][0] = \
+    c->PFX ## _rv40_qpel_pixels_tab[IDX][0] = \
+        c->PFX ## _h264_qpel_pixels_tab[IDX][0]
+
+    FPEL_MC(put, 0);
+    FPEL_MC(avg, 0);
+    FPEL_MC(put, 1);
+    FPEL_MC(avg, 1);
+
+    c->put_mspel_pixels_tab[0] = c->put_h264_qpel_pixels_tab[1][0];
+    c->put_vc1_mspel_pixels_tab[0] = c->put_pixels_tab[1][0];
+    c->avg_vc1_mspel_pixels_tab[0] = c->avg_pixels_tab[1][0];
+
     switch(c->idct_permutation_type){
     case FF_NO_IDCT_PERM:
         for(i=0; i<64; i++)
-- 
1.6.6




More information about the ffmpeg-devel mailing list