Browse code

dsputil: Split off H.263 bits into their own H263DSPContext

Diego Biurrun authored on 2013/11/05 16:11:47
Showing 15 changed files
... ...
@@ -1384,6 +1384,7 @@ CONFIG_EXTRA="
1384 1384
     gcrypt
1385 1385
     golomb
1386 1386
     gplv3
1387
+    h263dsp
1387 1388
     h264chroma
1388 1389
     h264dsp
1389 1390
     h264pred
... ...
@@ -1598,8 +1599,8 @@ g2m_decoder_deps="zlib"
1598 1598
 g2m_decoder_select="dsputil"
1599 1599
 h261_decoder_select="error_resilience mpegvideo"
1600 1600
 h261_encoder_select="aandcttables mpegvideoenc"
1601
-h263_decoder_select="error_resilience h263_parser mpegvideo"
1602
-h263_encoder_select="aandcttables mpegvideoenc"
1601
+h263_decoder_select="error_resilience h263_parser h263dsp mpegvideo"
1602
+h263_encoder_select="aandcttables h263dsp mpegvideoenc"
1603 1603
 h263i_decoder_select="h263_decoder"
1604 1604
 h263p_encoder_select="h263_encoder"
1605 1605
 h264_decoder_select="golomb h264chroma h264dsp h264pred h264qpel videodsp"
... ...
@@ -1665,9 +1666,9 @@ qcelp_decoder_select="lsp"
1665 1665
 qdm2_decoder_select="mdct rdft mpegaudiodsp"
1666 1666
 ra_144_encoder_select="audio_frame_queue lpc"
1667 1667
 ralf_decoder_select="golomb"
1668
-rv10_decoder_select="error_resilience h263_decoder"
1668
+rv10_decoder_select="error_resilience h263_decoder h263dsp"
1669 1669
 rv10_encoder_select="h263_encoder"
1670
-rv20_decoder_select="error_resilience h263_decoder"
1670
+rv20_decoder_select="error_resilience h263_decoder h263dsp"
1671 1671
 rv20_encoder_select="h263_encoder"
1672 1672
 rv30_decoder_select="error_resilience golomb h264chroma h264pred h264qpel mpegvideo videodsp"
1673 1673
 rv40_decoder_select="error_resilience golomb h264chroma h264pred h264qpel mpegvideo videodsp"
... ...
@@ -41,6 +41,7 @@ FFT-OBJS-$(CONFIG_HARDCODED_TABLES)    += cos_tables.o cos_fixed_tables.o
41 41
 OBJS-$(CONFIG_FFT)                     += avfft.o fft_fixed.o fft_float.o \
42 42
                                           $(FFT-OBJS-yes)
43 43
 OBJS-$(CONFIG_GOLOMB)                  += golomb.o
44
+OBJS-$(CONFIG_H263DSP)                 += h263dsp.o
44 45
 OBJS-$(CONFIG_H264CHROMA)              += h264chroma.o
45 46
 OBJS-$(CONFIG_H264DSP)                 += h264dsp.o h264idct.o
46 47
 OBJS-$(CONFIG_H264PRED)                += h264pred.o
... ...
@@ -1409,80 +1409,6 @@ static void put_mspel8_mc22_c(uint8_t *dst, uint8_t *src, ptrdiff_t stride)
1409 1409
     wmv2_mspel8_v_lowpass(dst, halfH+8, stride, 8, 8);
1410 1410
 }
1411 1411
 
1412
-static void h263_v_loop_filter_c(uint8_t *src, int stride, int qscale){
1413
-    if(CONFIG_H263_DECODER || CONFIG_H263_ENCODER) {
1414
-    int x;
1415
-    const int strength= ff_h263_loop_filter_strength[qscale];
1416
-
1417
-    for(x=0; x<8; x++){
1418
-        int d1, d2, ad1;
1419
-        int p0= src[x-2*stride];
1420
-        int p1= src[x-1*stride];
1421
-        int p2= src[x+0*stride];
1422
-        int p3= src[x+1*stride];
1423
-        int d = (p0 - p3 + 4*(p2 - p1)) / 8;
1424
-
1425
-        if     (d<-2*strength) d1= 0;
1426
-        else if(d<-  strength) d1=-2*strength - d;
1427
-        else if(d<   strength) d1= d;
1428
-        else if(d< 2*strength) d1= 2*strength - d;
1429
-        else                   d1= 0;
1430
-
1431
-        p1 += d1;
1432
-        p2 -= d1;
1433
-        if(p1&256) p1= ~(p1>>31);
1434
-        if(p2&256) p2= ~(p2>>31);
1435
-
1436
-        src[x-1*stride] = p1;
1437
-        src[x+0*stride] = p2;
1438
-
1439
-        ad1= FFABS(d1)>>1;
1440
-
1441
-        d2= av_clip((p0-p3)/4, -ad1, ad1);
1442
-
1443
-        src[x-2*stride] = p0 - d2;
1444
-        src[x+  stride] = p3 + d2;
1445
-    }
1446
-    }
1447
-}
1448
-
1449
-static void h263_h_loop_filter_c(uint8_t *src, int stride, int qscale){
1450
-    if(CONFIG_H263_DECODER || CONFIG_H263_ENCODER) {
1451
-    int y;
1452
-    const int strength= ff_h263_loop_filter_strength[qscale];
1453
-
1454
-    for(y=0; y<8; y++){
1455
-        int d1, d2, ad1;
1456
-        int p0= src[y*stride-2];
1457
-        int p1= src[y*stride-1];
1458
-        int p2= src[y*stride+0];
1459
-        int p3= src[y*stride+1];
1460
-        int d = (p0 - p3 + 4*(p2 - p1)) / 8;
1461
-
1462
-        if     (d<-2*strength) d1= 0;
1463
-        else if(d<-  strength) d1=-2*strength - d;
1464
-        else if(d<   strength) d1= d;
1465
-        else if(d< 2*strength) d1= 2*strength - d;
1466
-        else                   d1= 0;
1467
-
1468
-        p1 += d1;
1469
-        p2 -= d1;
1470
-        if(p1&256) p1= ~(p1>>31);
1471
-        if(p2&256) p2= ~(p2>>31);
1472
-
1473
-        src[y*stride-1] = p1;
1474
-        src[y*stride+0] = p2;
1475
-
1476
-        ad1= FFABS(d1)>>1;
1477
-
1478
-        d2= av_clip((p0-p3)/4, -ad1, ad1);
1479
-
1480
-        src[y*stride-2] = p0 - d2;
1481
-        src[y*stride+1] = p3 + d2;
1482
-    }
1483
-    }
1484
-}
1485
-
1486 1412
 static inline int pix_abs16_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
1487 1413
 {
1488 1414
     int s, i;
... ...
@@ -2701,11 +2627,6 @@ av_cold void ff_dsputil_init(DSPContext* c, AVCodecContext *avctx)
2701 2701
     c->bswap_buf= bswap_buf;
2702 2702
     c->bswap16_buf = bswap16_buf;
2703 2703
 
2704
-    if (CONFIG_H263_DECODER || CONFIG_H263_ENCODER) {
2705
-        c->h263_h_loop_filter= h263_h_loop_filter_c;
2706
-        c->h263_v_loop_filter= h263_v_loop_filter_c;
2707
-    }
2708
-
2709 2704
     c->try_8x8basis= try_8x8basis_c;
2710 2705
     c->add_8x8basis= add_8x8basis_c;
2711 2706
 
... ...
@@ -202,9 +202,6 @@ typedef struct DSPContext {
202 202
     void (*bswap_buf)(uint32_t *dst, const uint32_t *src, int w);
203 203
     void (*bswap16_buf)(uint16_t *dst, const uint16_t *src, int len);
204 204
 
205
-    void (*h263_v_loop_filter)(uint8_t *src, int stride, int qscale);
206
-    void (*h263_h_loop_filter)(uint8_t *src, int stride, int qscale);
207
-
208 205
     /* assume len is a multiple of 8, and arrays are 16-byte aligned */
209 206
     void (*vector_clipf)(float *dst /* align 16 */, const float *src /* align 16 */, float min, float max, int len /* align 16 */);
210 207
 
... ...
@@ -152,8 +152,8 @@ void ff_h263_loop_filter(MpegEncContext * s){
152 152
     */
153 153
     if (!IS_SKIP(s->current_picture.mb_type[xy])) {
154 154
         qp_c= s->qscale;
155
-        s->dsp.h263_v_loop_filter(dest_y+8*linesize  , linesize, qp_c);
156
-        s->dsp.h263_v_loop_filter(dest_y+8*linesize+8, linesize, qp_c);
155
+        s->h263dsp.h263_v_loop_filter(dest_y + 8 * linesize,     linesize, qp_c);
156
+        s->h263dsp.h263_v_loop_filter(dest_y + 8 * linesize + 8, linesize, qp_c);
157 157
     }else
158 158
         qp_c= 0;
159 159
 
... ...
@@ -172,15 +172,15 @@ void ff_h263_loop_filter(MpegEncContext * s){
172 172
 
173 173
         if(qp_tc){
174 174
             const int chroma_qp= s->chroma_qscale_table[qp_tc];
175
-            s->dsp.h263_v_loop_filter(dest_y  ,   linesize, qp_tc);
176
-            s->dsp.h263_v_loop_filter(dest_y+8,   linesize, qp_tc);
175
+            s->h263dsp.h263_v_loop_filter(dest_y,     linesize, qp_tc);
176
+            s->h263dsp.h263_v_loop_filter(dest_y + 8, linesize, qp_tc);
177 177
 
178
-            s->dsp.h263_v_loop_filter(dest_cb , uvlinesize, chroma_qp);
179
-            s->dsp.h263_v_loop_filter(dest_cr , uvlinesize, chroma_qp);
178
+            s->h263dsp.h263_v_loop_filter(dest_cb, uvlinesize, chroma_qp);
179
+            s->h263dsp.h263_v_loop_filter(dest_cr, uvlinesize, chroma_qp);
180 180
         }
181 181
 
182 182
         if(qp_tt)
183
-            s->dsp.h263_h_loop_filter(dest_y-8*linesize+8  ,   linesize, qp_tt);
183
+            s->h263dsp.h263_h_loop_filter(dest_y - 8 * linesize + 8, linesize, qp_tt);
184 184
 
185 185
         if(s->mb_x){
186 186
             if (qp_tt || IS_SKIP(s->current_picture.mb_type[xy - 1 - s->mb_stride]))
... ...
@@ -190,17 +190,17 @@ void ff_h263_loop_filter(MpegEncContext * s){
190 190
 
191 191
             if(qp_dt){
192 192
                 const int chroma_qp= s->chroma_qscale_table[qp_dt];
193
-                s->dsp.h263_h_loop_filter(dest_y -8*linesize  ,   linesize, qp_dt);
194
-                s->dsp.h263_h_loop_filter(dest_cb-8*uvlinesize, uvlinesize, chroma_qp);
195
-                s->dsp.h263_h_loop_filter(dest_cr-8*uvlinesize, uvlinesize, chroma_qp);
193
+                s->h263dsp.h263_h_loop_filter(dest_y  - 8 * linesize,   linesize,   qp_dt);
194
+                s->h263dsp.h263_h_loop_filter(dest_cb - 8 * uvlinesize, uvlinesize, chroma_qp);
195
+                s->h263dsp.h263_h_loop_filter(dest_cr - 8 * uvlinesize, uvlinesize, chroma_qp);
196 196
             }
197 197
         }
198 198
     }
199 199
 
200 200
     if(qp_c){
201
-        s->dsp.h263_h_loop_filter(dest_y +8,   linesize, qp_c);
201
+        s->h263dsp.h263_h_loop_filter(dest_y + 8, linesize, qp_c);
202 202
         if(s->mb_y + 1 == s->mb_height)
203
-            s->dsp.h263_h_loop_filter(dest_y+8*linesize+8,   linesize, qp_c);
203
+            s->h263dsp.h263_h_loop_filter(dest_y + 8 * linesize + 8, linesize, qp_c);
204 204
     }
205 205
 
206 206
     if(s->mb_x){
... ...
@@ -211,12 +211,12 @@ void ff_h263_loop_filter(MpegEncContext * s){
211 211
             qp_lc = s->current_picture.qscale_table[xy - 1];
212 212
 
213 213
         if(qp_lc){
214
-            s->dsp.h263_h_loop_filter(dest_y,   linesize, qp_lc);
214
+            s->h263dsp.h263_h_loop_filter(dest_y, linesize, qp_lc);
215 215
             if(s->mb_y + 1 == s->mb_height){
216 216
                 const int chroma_qp= s->chroma_qscale_table[qp_lc];
217
-                s->dsp.h263_h_loop_filter(dest_y +8*  linesize,   linesize, qp_lc);
218
-                s->dsp.h263_h_loop_filter(dest_cb             , uvlinesize, chroma_qp);
219
-                s->dsp.h263_h_loop_filter(dest_cr             , uvlinesize, chroma_qp);
217
+                s->h263dsp.h263_h_loop_filter(dest_y + 8 * linesize, linesize, qp_lc);
218
+                s->h263dsp.h263_h_loop_filter(dest_cb, uvlinesize, chroma_qp);
219
+                s->h263dsp.h263_h_loop_filter(dest_cr, uvlinesize, chroma_qp);
220 220
             }
221 221
         }
222 222
     }
... ...
@@ -272,11 +272,6 @@ uint8_t ff_mba_length[7]={
272 272
       6,   7,   9,  11,  13,  14,  14
273 273
 };
274 274
 
275
-const uint8_t ff_h263_loop_filter_strength[32]={
276
-//  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
277
-    0, 1, 1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9,10,10,10,11,11,11,12,12,12
278
-};
279
-
280 275
 const AVRational ff_h263_pixel_aspect[16]={
281 276
  {0, 1},
282 277
  {1, 1},
... ...
@@ -116,6 +116,7 @@ av_cold int ff_h263_decode_init(AVCodecContext *avctx)
116 116
         if ((ret = ff_MPV_common_init(s)) < 0)
117 117
             return ret;
118 118
 
119
+    ff_h263dsp_init(&s->h263dsp);
119 120
     ff_h263_decode_init_vlc();
120 121
 
121 122
     return 0;
122 123
new file mode 100644
... ...
@@ -0,0 +1,108 @@
0
+/*
1
+ * This file is part of Libav.
2
+ *
3
+ * Libav is free software; you can redistribute it and/or
4
+ * modify it under the terms of the GNU Lesser General Public
5
+ * License as published by the Free Software Foundation; either
6
+ * version 2.1 of the License, or (at your option) any later version.
7
+ *
8
+ * Libav is distributed in the hope that it will be useful,
9
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11
+ * Lesser General Public License for more details.
12
+ *
13
+ * You should have received a copy of the GNU Lesser General Public
14
+ * License along with Libav; if not, write to the Free Software
15
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+ */
17
+
18
+#include <stdint.h>
19
+
20
+#include "libavutil/attributes.h"
21
+#include "libavutil/common.h"
22
+#include "config.h"
23
+#include "h263dsp.h"
24
+
25
+const uint8_t ff_h263_loop_filter_strength[32]={
26
+//  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
27
+    0, 1, 1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9,10,10,10,11,11,11,12,12,12
28
+};
29
+
30
+static void h263_h_loop_filter_c(uint8_t *src, int stride, int qscale){
31
+    int y;
32
+    const int strength= ff_h263_loop_filter_strength[qscale];
33
+
34
+    for(y=0; y<8; y++){
35
+        int d1, d2, ad1;
36
+        int p0= src[y*stride-2];
37
+        int p1= src[y*stride-1];
38
+        int p2= src[y*stride+0];
39
+        int p3= src[y*stride+1];
40
+        int d = (p0 - p3 + 4*(p2 - p1)) / 8;
41
+
42
+        if     (d<-2*strength) d1= 0;
43
+        else if(d<-  strength) d1=-2*strength - d;
44
+        else if(d<   strength) d1= d;
45
+        else if(d< 2*strength) d1= 2*strength - d;
46
+        else                   d1= 0;
47
+
48
+        p1 += d1;
49
+        p2 -= d1;
50
+        if(p1&256) p1= ~(p1>>31);
51
+        if(p2&256) p2= ~(p2>>31);
52
+
53
+        src[y*stride-1] = p1;
54
+        src[y*stride+0] = p2;
55
+
56
+        ad1= FFABS(d1)>>1;
57
+
58
+        d2= av_clip((p0-p3)/4, -ad1, ad1);
59
+
60
+        src[y*stride-2] = p0 - d2;
61
+        src[y*stride+1] = p3 + d2;
62
+    }
63
+}
64
+
65
+static void h263_v_loop_filter_c(uint8_t *src, int stride, int qscale){
66
+    int x;
67
+    const int strength= ff_h263_loop_filter_strength[qscale];
68
+
69
+    for(x=0; x<8; x++){
70
+        int d1, d2, ad1;
71
+        int p0= src[x-2*stride];
72
+        int p1= src[x-1*stride];
73
+        int p2= src[x+0*stride];
74
+        int p3= src[x+1*stride];
75
+        int d = (p0 - p3 + 4*(p2 - p1)) / 8;
76
+
77
+        if     (d<-2*strength) d1= 0;
78
+        else if(d<-  strength) d1=-2*strength - d;
79
+        else if(d<   strength) d1= d;
80
+        else if(d< 2*strength) d1= 2*strength - d;
81
+        else                   d1= 0;
82
+
83
+        p1 += d1;
84
+        p2 -= d1;
85
+        if(p1&256) p1= ~(p1>>31);
86
+        if(p2&256) p2= ~(p2>>31);
87
+
88
+        src[x-1*stride] = p1;
89
+        src[x+0*stride] = p2;
90
+
91
+        ad1= FFABS(d1)>>1;
92
+
93
+        d2= av_clip((p0-p3)/4, -ad1, ad1);
94
+
95
+        src[x-2*stride] = p0 - d2;
96
+        src[x+  stride] = p3 + d2;
97
+    }
98
+}
99
+
100
+av_cold void ff_h263dsp_init(H263DSPContext *ctx)
101
+{
102
+    ctx->h263_h_loop_filter = h263_h_loop_filter_c;
103
+    ctx->h263_v_loop_filter = h263_v_loop_filter_c;
104
+
105
+    if (ARCH_X86)
106
+        ff_h263dsp_init_x86(ctx);
107
+}
0 108
new file mode 100644
... ...
@@ -0,0 +1,34 @@
0
+/*
1
+ * This file is part of Libav.
2
+ *
3
+ * Libav is free software; you can redistribute it and/or
4
+ * modify it under the terms of the GNU Lesser General Public
5
+ * License as published by the Free Software Foundation; either
6
+ * version 2.1 of the License, or (at your option) any later version.
7
+ *
8
+ * Libav is distributed in the hope that it will be useful,
9
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11
+ * Lesser General Public License for more details.
12
+ *
13
+ * You should have received a copy of the GNU Lesser General Public
14
+ * License along with Libav; if not, write to the Free Software
15
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+ */
17
+
18
+#ifndef AVCODEC_H263DSP_H
19
+#define AVCODEC_H263DSP_H
20
+
21
+#include <stdint.h>
22
+
23
+extern const uint8_t ff_h263_loop_filter_strength[32];
24
+
25
+typedef struct H263DSPContext {
26
+    void (*h263_h_loop_filter)(uint8_t *src, int stride, int qscale);
27
+    void (*h263_v_loop_filter)(uint8_t *src, int stride, int qscale);
28
+} H263DSPContext;
29
+
30
+void ff_h263dsp_init(H263DSPContext *ctx);
31
+void ff_h263dsp_init_x86(H263DSPContext *ctx);
32
+
33
+#endif /* AVCODEC_H263DSP_H */
... ...
@@ -32,6 +32,7 @@
32 32
 #include "dsputil.h"
33 33
 #include "error_resilience.h"
34 34
 #include "get_bits.h"
35
+#include "h263dsp.h"
35 36
 #include "hpeldsp.h"
36 37
 #include "put_bits.h"
37 38
 #include "ratecontrol.h"
... ...
@@ -384,6 +385,7 @@ typedef struct MpegEncContext {
384 384
     DSPContext dsp;             ///< pointers for accelerated dsp functions
385 385
     HpelDSPContext hdsp;
386 386
     VideoDSPContext vdsp;
387
+    H263DSPContext h263dsp;
387 388
     int f_code;                 ///< forward MV resolution
388 389
     int b_code;                 ///< backward MV resolution for B Frames (mpeg4)
389 390
     int16_t (*p_mv_table_base)[2];
... ...
@@ -896,7 +898,6 @@ void ff_mpeg1_encode_slice_header(MpegEncContext *s);
896 896
 
897 897
 extern const uint8_t ff_aic_dc_scale_table[32];
898 898
 extern const uint8_t ff_h263_chroma_qscale_table[32];
899
-extern const uint8_t ff_h263_loop_filter_strength[32];
900 899
 
901 900
 /* rv10.c */
902 901
 void ff_rv10_encode_picture_header(MpegEncContext *s, int picture_number);
... ...
@@ -707,6 +707,7 @@ av_cold int ff_MPV_encode_init(AVCodecContext *avctx)
707 707
     if (ARCH_X86)
708 708
         ff_MPV_encode_init_x86(s);
709 709
 
710
+    ff_h263dsp_init(&s->h263dsp);
710 711
     if (!s->dct_quantize)
711 712
         s->dct_quantize = ff_dct_quantize_c;
712 713
     if (!s->denoise_dct)
... ...
@@ -484,6 +484,7 @@ static av_cold int rv10_decode_init(AVCodecContext *avctx)
484 484
     if ((ret = ff_MPV_common_init(s)) < 0)
485 485
         return ret;
486 486
 
487
+    ff_h263dsp_init(&s->h263dsp);
487 488
     ff_h263_decode_init_vlc();
488 489
 
489 490
     /* init rv vlc */
... ...
@@ -12,6 +12,7 @@ OBJS-$(CONFIG_ENCODERS)                += x86/dsputilenc_mmx.o          \
12 12
                                           x86/fdct.o                    \
13 13
                                           x86/motion_est.o
14 14
 OBJS-$(CONFIG_FFT)                     += x86/fft_init.o
15
+OBJS-$(CONFIG_H263DSP)                 += x86/h263dsp_init.o
15 16
 OBJS-$(CONFIG_H264CHROMA)              += x86/h264chroma_init.o
16 17
 OBJS-$(CONFIG_H264DSP)                 += x86/h264dsp_init.o
17 18
 OBJS-$(CONFIG_H264PRED)                += x86/h264_intrapred_init.o
... ...
@@ -59,8 +60,7 @@ YASM-OBJS-$(CONFIG_DSPUTIL)            += x86/dsputil.o                 \
59 59
                                           x86/qpel.o
60 60
 YASM-OBJS-$(CONFIG_ENCODERS)           += x86/dsputilenc.o
61 61
 YASM-OBJS-$(CONFIG_FFT)                += x86/fft.o
62
-YASM-OBJS-$(CONFIG_H263_DECODER)       += x86/h263_loopfilter.o
63
-YASM-OBJS-$(CONFIG_H263_ENCODER)       += x86/h263_loopfilter.o
62
+YASM-OBJS-$(CONFIG_H263DSP)            += x86/h263_loopfilter.o
64 63
 YASM-OBJS-$(CONFIG_H264CHROMA)         += x86/h264_chromamc.o           \
65 64
                                           x86/h264_chromamc_10bit.o
66 65
 YASM-OBJS-$(CONFIG_H264DSP)            += x86/h264_deblock.o            \
... ...
@@ -68,9 +68,6 @@ void ff_put_no_rnd_mpeg4_qpel8_v_lowpass_mmxext(uint8_t *dst, uint8_t *src,
68 68
 #define ff_put_no_rnd_pixels16_mmxext ff_put_pixels16_mmxext
69 69
 #define ff_put_no_rnd_pixels8_mmxext ff_put_pixels8_mmxext
70 70
 
71
-void ff_h263_v_loop_filter_mmx(uint8_t *src, int stride, int qscale);
72
-void ff_h263_h_loop_filter_mmx(uint8_t *src, int stride, int qscale);
73
-
74 71
 int32_t ff_scalarproduct_int16_mmxext(const int16_t *v1, const int16_t *v2,
75 72
                                       int order);
76 73
 int32_t ff_scalarproduct_int16_sse2(const int16_t *v1, const int16_t *v2,
... ...
@@ -566,11 +563,6 @@ static av_cold void dsputil_init_mmx(DSPContext *c, AVCodecContext *avctx,
566 566
 #endif /* HAVE_MMX_INLINE */
567 567
 
568 568
 #if HAVE_MMX_EXTERNAL
569
-    if (CONFIG_H263_DECODER || CONFIG_H263_ENCODER) {
570
-        c->h263_v_loop_filter = ff_h263_v_loop_filter_mmx;
571
-        c->h263_h_loop_filter = ff_h263_h_loop_filter_mmx;
572
-    }
573
-
574 569
     c->vector_clip_int32 = ff_vector_clip_int32_mmx;
575 570
 #endif /* HAVE_MMX_EXTERNAL */
576 571
 }
577 572
new file mode 100644
... ...
@@ -0,0 +1,39 @@
0
+/*
1
+ * Copyright (c) 2013 Diego Biurrun <diego@biurrun.de>
2
+ *
3
+ * This file is part of Libav.
4
+ *
5
+ * Libav is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
9
+ *
10
+ * Libav is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with Libav; if not, write to the Free Software
17
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
+ */
19
+
20
+#include <stdint.h>
21
+
22
+#include "libavutil/attributes.h"
23
+#include "libavutil/cpu.h"
24
+#include "libavutil/x86/cpu.h"
25
+#include "libavcodec/h263dsp.h"
26
+
27
+void ff_h263_h_loop_filter_mmx(uint8_t *src, int stride, int qscale);
28
+void ff_h263_v_loop_filter_mmx(uint8_t *src, int stride, int qscale);
29
+
30
+av_cold void ff_h263dsp_init_x86(H263DSPContext *c)
31
+{
32
+    int cpu_flags = av_get_cpu_flags();
33
+
34
+    if (EXTERNAL_MMX(cpu_flags)) {
35
+        c->h263_h_loop_filter = ff_h263_h_loop_filter_mmx;
36
+        c->h263_v_loop_filter = ff_h263_v_loop_filter_mmx;
37
+    }
38
+}