[FFmpeg-cvslog] r26135 - in trunk/libavcodec/x86: h264_intrapred.asm h264_intrapred_init.c

rbultje subversion
Wed Dec 29 19:00:27 CET 2010


Author: rbultje
Date: Wed Dec 29 19:00:26 2010
New Revision: 26135

Log:
Port pred8x8_dc_mmxext (H.264 intra prediction) from x264 to FFmpeg. Original
authors: Holger Lubitz <holger lubitz org>, Jason Garrett-Glaser <darkshikari
gmail com> (approves LGPL relicensing for this code) and Loren Merritt <lorenm
at u dot washington dot edu> (approves LGPL relicensing for this code). Patch
by Daniel Kang <daniel dot d dot kang at gmail com>, as part of Google's GCI
2010.

Modified:
   trunk/libavcodec/x86/h264_intrapred.asm
   trunk/libavcodec/x86/h264_intrapred_init.c

Modified: trunk/libavcodec/x86/h264_intrapred.asm
==============================================================================
--- trunk/libavcodec/x86/h264_intrapred.asm	Wed Dec 29 18:48:57 2010	(r26134)
+++ trunk/libavcodec/x86/h264_intrapred.asm	Wed Dec 29 19:00:26 2010	(r26135)
@@ -866,6 +866,68 @@ cglobal pred8x8_top_dc_mmxext, 2,5
 %endif
 
 ;-----------------------------------------------------------------------------
+; void pred8x8_dc_mmxext(uint8_t *src, int stride)
+;-----------------------------------------------------------------------------
+%ifdef CONFIG_GPL
+INIT_MMX
+cglobal pred8x8_dc_mmxext, 2,5
+    sub       r0, r1
+    pxor      m7, m7
+    movd      m0, [r0+0]
+    movd      m1, [r0+4]
+    psadbw    m0, m7            ; s0
+    mov       r4, r0
+    psadbw    m1, m7            ; s1
+
+    movzx    r2d, byte [r0+r1*1-1]
+    movzx    r3d, byte [r0+r1*2-1]
+    lea       r0, [r0+r1*2]
+    add      r2d, r3d
+    movzx    r3d, byte [r0+r1*1-1]
+    add      r2d, r3d
+    movzx    r3d, byte [r0+r1*2-1]
+    add      r2d, r3d
+    lea       r0, [r0+r1*2]
+    movd      m2, r2d            ; s2
+    movzx    r2d, byte [r0+r1*1-1]
+    movzx    r3d, byte [r0+r1*2-1]
+    lea       r0, [r0+r1*2]
+    add      r2d, r3d
+    movzx    r3d, byte [r0+r1*1-1]
+    add      r2d, r3d
+    movzx    r3d, byte [r0+r1*2-1]
+    add      r2d, r3d
+    movd      m3, r2d            ; s3
+
+    punpcklwd m0, m1
+    mov       r0, r4
+    punpcklwd m2, m3
+    punpckldq m0, m2            ; s0, s1, s2, s3
+    pshufw    m3, m0, 11110110b ; s2, s1, s3, s3
+    lea       r2, [r0+r1*2]
+    pshufw    m0, m0, 01110100b ; s0, s1, s3, s1
+    paddw     m0, m3
+    lea       r3, [r2+r1*2]
+    psrlw     m0, 2
+    pavgw     m0, m7            ; s0+s2, s1, s3, s1+s3
+    lea       r4, [r3+r1*2]
+    packuswb  m0, m0
+    punpcklbw m0, m0
+    movq      m1, m0
+    punpcklbw m0, m0
+    punpckhbw m1, m1
+    movq [r0+r1*1], m0
+    movq [r0+r1*2], m0
+    movq [r2+r1*1], m0
+    movq [r2+r1*2], m0
+    movq [r3+r1*1], m1
+    movq [r3+r1*2], m1
+    movq [r4+r1*1], m1
+    movq [r4+r1*2], m1
+    RET
+%endif
+
+;-----------------------------------------------------------------------------
 ; void pred8x8_dc_rv40(uint8_t *src, int stride)
 ;-----------------------------------------------------------------------------
 

Modified: trunk/libavcodec/x86/h264_intrapred_init.c
==============================================================================
--- trunk/libavcodec/x86/h264_intrapred_init.c	Wed Dec 29 18:48:57 2010	(r26134)
+++ trunk/libavcodec/x86/h264_intrapred_init.c	Wed Dec 29 19:00:26 2010	(r26135)
@@ -46,6 +46,7 @@ void ff_pred16x16_tm_vp8_mmxext    (uint
 void ff_pred16x16_tm_vp8_sse2      (uint8_t *src, int stride);
 void ff_pred8x8_top_dc_mmxext      (uint8_t *src, int stride);
 void ff_pred8x8_dc_rv40_mmxext     (uint8_t *src, int stride);
+void ff_pred8x8_dc_mmxext          (uint8_t *src, int stride);
 void ff_pred8x8_vertical_mmx       (uint8_t *src, int stride);
 void ff_pred8x8_horizontal_mmx     (uint8_t *src, int stride);
 void ff_pred8x8_horizontal_mmxext  (uint8_t *src, int stride);
@@ -101,6 +102,7 @@ void ff_h264_pred_init_x86(H264PredConte
             h->pred4x4  [DIAG_DOWN_LEFT_PRED ] = ff_pred4x4_down_left_mmxext;
         if (codec_id == CODEC_ID_SVQ3 || codec_id == CODEC_ID_H264) {
             h->pred8x8  [TOP_DC_PRED8x8      ] = ff_pred8x8_top_dc_mmxext;
+            h->pred8x8  [DC_PRED8x8          ] = ff_pred8x8_dc_mmxext;
         }
 #endif
         if (codec_id == CODEC_ID_VP8) {



More information about the ffmpeg-cvslog mailing list