h264: Add x86 assembly for 10-bit weight/biweight H.264 functions.
[ffmpeg.git] / libavcodec / x86 / h264dsp_mmx.c
index 3fccd08..1042552 100644 (file)
@@ -326,6 +326,30 @@ H264_BIWEIGHT_MMX    ( 4,  8)
 H264_BIWEIGHT_MMX    ( 4,  4)
 H264_BIWEIGHT_MMX    ( 4,  2)
 
 H264_BIWEIGHT_MMX    ( 4,  4)
 H264_BIWEIGHT_MMX    ( 4,  2)
 
+#define H264_WEIGHT_10(W, H, DEPTH, OPT) \
+void ff_h264_weight_ ## W ## x ## H ## _ ## DEPTH ## _ ## OPT(uint8_t *dst, \
+    int stride, int log2_denom, int weight, int offset);
+
+#define H264_BIWEIGHT_10(W, H, DEPTH, OPT) \
+void ff_h264_biweight_ ## W ## x ## H ## _ ## DEPTH ## _ ## OPT \
+    (uint8_t *dst, uint8_t *src, int stride, int log2_denom, \
+     int weightd, int weights, int offset);
+
+#define H264_BIWEIGHT_10_SSE(W, H, DEPTH) \
+H264_WEIGHT_10  (W, H, DEPTH, sse2) \
+H264_WEIGHT_10  (W, H, DEPTH, sse4) \
+H264_BIWEIGHT_10(W, H, DEPTH, sse2) \
+H264_BIWEIGHT_10(W, H, DEPTH, sse4)
+
+H264_BIWEIGHT_10_SSE(16, 16, 10)
+H264_BIWEIGHT_10_SSE(16,  8, 10)
+H264_BIWEIGHT_10_SSE( 8, 16, 10)
+H264_BIWEIGHT_10_SSE( 8,  8, 10)
+H264_BIWEIGHT_10_SSE( 8,  4, 10)
+H264_BIWEIGHT_10_SSE( 4,  8, 10)
+H264_BIWEIGHT_10_SSE( 4,  4, 10)
+H264_BIWEIGHT_10_SSE( 4,  2, 10)
+
 void ff_h264dsp_init_x86(H264DSPContext *c, const int bit_depth)
 {
     int mm_flags = av_get_cpu_flags();
 void ff_h264dsp_init_x86(H264DSPContext *c, const int bit_depth)
 {
     int mm_flags = av_get_cpu_flags();
@@ -454,6 +478,24 @@ void ff_h264dsp_init_x86(H264DSPContext *c, const int bit_depth)
                 c->h264_idct8_add4     = ff_h264_idct8_add4_10_sse2;
 #endif
 
                 c->h264_idct8_add4     = ff_h264_idct8_add4_10_sse2;
 #endif
 
+                c->weight_h264_pixels_tab[0] = ff_h264_weight_16x16_10_sse2;
+                c->weight_h264_pixels_tab[1] = ff_h264_weight_16x8_10_sse2;
+                c->weight_h264_pixels_tab[2] = ff_h264_weight_8x16_10_sse2;
+                c->weight_h264_pixels_tab[3] = ff_h264_weight_8x8_10_sse2;
+                c->weight_h264_pixels_tab[4] = ff_h264_weight_8x4_10_sse2;
+                c->weight_h264_pixels_tab[5] = ff_h264_weight_4x8_10_sse2;
+                c->weight_h264_pixels_tab[6] = ff_h264_weight_4x4_10_sse2;
+                c->weight_h264_pixels_tab[7] = ff_h264_weight_4x2_10_sse2;
+
+                c->biweight_h264_pixels_tab[0] = ff_h264_biweight_16x16_10_sse2;
+                c->biweight_h264_pixels_tab[1] = ff_h264_biweight_16x8_10_sse2;
+                c->biweight_h264_pixels_tab[2] = ff_h264_biweight_8x16_10_sse2;
+                c->biweight_h264_pixels_tab[3] = ff_h264_biweight_8x8_10_sse2;
+                c->biweight_h264_pixels_tab[4] = ff_h264_biweight_8x4_10_sse2;
+                c->biweight_h264_pixels_tab[5] = ff_h264_biweight_4x8_10_sse2;
+                c->biweight_h264_pixels_tab[6] = ff_h264_biweight_4x4_10_sse2;
+                c->biweight_h264_pixels_tab[7] = ff_h264_biweight_4x2_10_sse2;
+
                 c->h264_v_loop_filter_chroma= ff_deblock_v_chroma_10_sse2;
                 c->h264_v_loop_filter_chroma_intra= ff_deblock_v_chroma_intra_10_sse2;
 #if HAVE_ALIGNED_STACK
                 c->h264_v_loop_filter_chroma= ff_deblock_v_chroma_10_sse2;
                 c->h264_v_loop_filter_chroma_intra= ff_deblock_v_chroma_intra_10_sse2;
 #if HAVE_ALIGNED_STACK
@@ -463,6 +505,25 @@ void ff_h264dsp_init_x86(H264DSPContext *c, const int bit_depth)
                 c->h264_h_loop_filter_luma_intra = ff_deblock_h_luma_intra_10_sse2;
 #endif
             }
                 c->h264_h_loop_filter_luma_intra = ff_deblock_h_luma_intra_10_sse2;
 #endif
             }
+            if (mm_flags&AV_CPU_FLAG_SSE4) {
+                c->weight_h264_pixels_tab[0] = ff_h264_weight_16x16_10_sse4;
+                c->weight_h264_pixels_tab[1] = ff_h264_weight_16x8_10_sse4;
+                c->weight_h264_pixels_tab[2] = ff_h264_weight_8x16_10_sse4;
+                c->weight_h264_pixels_tab[3] = ff_h264_weight_8x8_10_sse4;
+                c->weight_h264_pixels_tab[4] = ff_h264_weight_8x4_10_sse4;
+                c->weight_h264_pixels_tab[5] = ff_h264_weight_4x8_10_sse4;
+                c->weight_h264_pixels_tab[6] = ff_h264_weight_4x4_10_sse4;
+                c->weight_h264_pixels_tab[7] = ff_h264_weight_4x2_10_sse4;
+
+                c->biweight_h264_pixels_tab[0] = ff_h264_biweight_16x16_10_sse4;
+                c->biweight_h264_pixels_tab[1] = ff_h264_biweight_16x8_10_sse4;
+                c->biweight_h264_pixels_tab[2] = ff_h264_biweight_8x16_10_sse4;
+                c->biweight_h264_pixels_tab[3] = ff_h264_biweight_8x8_10_sse4;
+                c->biweight_h264_pixels_tab[4] = ff_h264_biweight_8x4_10_sse4;
+                c->biweight_h264_pixels_tab[5] = ff_h264_biweight_4x8_10_sse4;
+                c->biweight_h264_pixels_tab[6] = ff_h264_biweight_4x4_10_sse4;
+                c->biweight_h264_pixels_tab[7] = ff_h264_biweight_4x2_10_sse4;
+            }
 #if HAVE_AVX
             if (mm_flags&AV_CPU_FLAG_AVX) {
                 c->h264_idct_dc_add    =
 #if HAVE_AVX
             if (mm_flags&AV_CPU_FLAG_AVX) {
                 c->h264_idct_dc_add    =