Browse code

bink: use hpeldsp instead of dsputil for half-pel functions.

Ronald S. Bultje authored on 2013/03/11 01:12:01
Showing 2 changed files
... ...
@@ -1694,7 +1694,7 @@ ape_decoder_select="dsputil"
1694 1694
 asv_decoder_select="dsputil"
1695 1695
 atrac1_decoder_select="mdct sinewin"
1696 1696
 atrac3_decoder_select="mdct"
1697
-bink_decoder_select="dsputil"
1697
+bink_decoder_select="dsputil hpeldsp"
1698 1698
 binkaudio_dct_decoder_select="mdct rdft dct sinewin"
1699 1699
 binkaudio_rdft_decoder_select="mdct rdft sinewin"
1700 1700
 cavs_decoder_select="dsputil golomb h264chroma mpegvideo videodsp"
... ...
@@ -26,6 +26,7 @@
26 26
 #include "dsputil.h"
27 27
 #include "binkdata.h"
28 28
 #include "binkdsp.h"
29
+#include "hpeldsp.h"
29 30
 #include "internal.h"
30 31
 #include "mathops.h"
31 32
 
... ...
@@ -112,6 +113,7 @@ typedef struct Bundle {
112 112
 typedef struct BinkContext {
113 113
     AVCodecContext *avctx;
114 114
     DSPContext     dsp;
115
+    HpelDSPContext hdsp;
115 116
     BinkDSPContext bdsp;
116 117
     AVFrame        *last;
117 118
     int            version;              ///< internal Bink file version
... ...
@@ -878,7 +880,7 @@ static int binkb_decode_plane(BinkContext *c, AVFrame *frame, GetBitContext *gb,
878 878
                 if (ref < ref_start || ref + 8*stride > ref_end) {
879 879
                     av_log(c->avctx, AV_LOG_WARNING, "Reference block is out of bounds\n");
880 880
                 } else if (ref + 8*stride < dst || ref >= dst + 8*stride) {
881
-                    c->dsp.put_pixels_tab[1][0](dst, ref, stride, 8);
881
+                    c->hdsp.put_pixels_tab[1][0](dst, ref, stride, 8);
882 882
                 } else {
883 883
                     put_pixels8x8_overlapped(dst, ref, stride);
884 884
                 }
... ...
@@ -894,7 +896,7 @@ static int binkb_decode_plane(BinkContext *c, AVFrame *frame, GetBitContext *gb,
894 894
                 if (ref < ref_start || ref + 8 * stride > ref_end) {
895 895
                     av_log(c->avctx, AV_LOG_WARNING, "Reference block is out of bounds\n");
896 896
                 } else if (ref + 8*stride < dst || ref >= dst + 8*stride) {
897
-                    c->dsp.put_pixels_tab[1][0](dst, ref, stride, 8);
897
+                    c->hdsp.put_pixels_tab[1][0](dst, ref, stride, 8);
898 898
                 } else {
899 899
                     put_pixels8x8_overlapped(dst, ref, stride);
900 900
                 }
... ...
@@ -924,7 +926,7 @@ static int binkb_decode_plane(BinkContext *c, AVFrame *frame, GetBitContext *gb,
924 924
                 if (ref < ref_start || ref + 8 * stride > ref_end) {
925 925
                     av_log(c->avctx, AV_LOG_WARNING, "Reference block is out of bounds\n");
926 926
                 } else if (ref + 8*stride < dst || ref >= dst + 8*stride) {
927
-                    c->dsp.put_pixels_tab[1][0](dst, ref, stride, 8);
927
+                    c->hdsp.put_pixels_tab[1][0](dst, ref, stride, 8);
928 928
                 } else {
929 929
                     put_pixels8x8_overlapped(dst, ref, stride);
930 930
                 }
... ...
@@ -1013,7 +1015,7 @@ static int bink_decode_plane(BinkContext *c, AVFrame *frame, GetBitContext *gb,
1013 1013
             }
1014 1014
             switch (blk) {
1015 1015
             case SKIP_BLOCK:
1016
-                c->dsp.put_pixels_tab[1][0](dst, prev, stride, 8);
1016
+                c->hdsp.put_pixels_tab[1][0](dst, prev, stride, 8);
1017 1017
                 break;
1018 1018
             case SCALED_BLOCK:
1019 1019
                 blk = get_value(c, BINK_SRC_SUB_BLOCK_TYPES);
... ...
@@ -1084,7 +1086,7 @@ static int bink_decode_plane(BinkContext *c, AVFrame *frame, GetBitContext *gb,
1084 1084
                            bx*8 + xoff, by*8 + yoff);
1085 1085
                     return AVERROR_INVALIDDATA;
1086 1086
                 }
1087
-                c->dsp.put_pixels_tab[1][0](dst, ref, stride, 8);
1087
+                c->hdsp.put_pixels_tab[1][0](dst, ref, stride, 8);
1088 1088
                 break;
1089 1089
             case RUN_BLOCK:
1090 1090
                 scan = bink_patterns[get_bits(gb, 4)];
... ...
@@ -1118,7 +1120,7 @@ static int bink_decode_plane(BinkContext *c, AVFrame *frame, GetBitContext *gb,
1118 1118
                            bx*8 + xoff, by*8 + yoff);
1119 1119
                     return AVERROR_INVALIDDATA;
1120 1120
                 }
1121
-                c->dsp.put_pixels_tab[1][0](dst, ref, stride, 8);
1121
+                c->hdsp.put_pixels_tab[1][0](dst, ref, stride, 8);
1122 1122
                 c->dsp.clear_block(block);
1123 1123
                 v = get_bits(gb, 7);
1124 1124
                 read_residue(gb, block, v);
... ...
@@ -1143,7 +1145,7 @@ static int bink_decode_plane(BinkContext *c, AVFrame *frame, GetBitContext *gb,
1143 1143
                            bx*8 + xoff, by*8 + yoff);
1144 1144
                     return -1;
1145 1145
                 }
1146
-                c->dsp.put_pixels_tab[1][0](dst, ref, stride, 8);
1146
+                c->hdsp.put_pixels_tab[1][0](dst, ref, stride, 8);
1147 1147
                 memset(dctblock, 0, sizeof(*dctblock) * 64);
1148 1148
                 dctblock[0] = get_value(c, BINK_SRC_INTER_DC);
1149 1149
                 read_dct_coeffs(gb, dctblock, bink_scan, bink_inter_quant, -1);
... ...
@@ -1305,6 +1307,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
1305 1305
     avctx->pix_fmt = c->has_alpha ? AV_PIX_FMT_YUVA420P : AV_PIX_FMT_YUV420P;
1306 1306
 
1307 1307
     ff_dsputil_init(&c->dsp, avctx);
1308
+    ff_hpeldsp_init(&c->hdsp, avctx->flags);
1308 1309
     ff_binkdsp_init(&c->bdsp);
1309 1310
 
1310 1311
     if ((ret = init_bundles(c)) < 0) {