[FFmpeg-soc] [soc]: r543 - in rv40: h264pred.c h264pred.h rv40.c

kostya subversion at mplayerhq.hu
Sun Jul 29 10:00:11 CEST 2007


Author: kostya
Date: Sun Jul 29 10:00:11 2007
New Revision: 543

Log:
Diagonal down left prediction in RV40 differs from H.264

Modified:
   rv40/h264pred.c
   rv40/h264pred.h
   rv40/rv40.c

Modified: rv40/h264pred.c
==============================================================================
--- rv40/h264pred.c	(original)
+++ rv40/h264pred.c	Sun Jul 29 10:00:11 2007
@@ -86,6 +86,12 @@ static void pred4x4_128_dc_c(uint8_t *sr
     const int av_unused t6= topright[2];\
     const int av_unused t7= topright[3];\
 
+#define LOAD_DOWN_LEFT_EDGE\
+    const int av_unused l4= src[-1+4*stride];\
+    const int av_unused l5= src[-1+5*stride];\
+    const int av_unused l6= src[-1+6*stride];\
+    const int av_unused l7= src[-1+7*stride];\
+
 #define LOAD_LEFT_EDGE\
     const int av_unused l0= left[0*stride];\
     const int av_unused l1= left[1*stride];\
@@ -144,6 +150,75 @@ static void pred4x4_down_left_c(uint8_t 
     src[3+3*stride]=(t6 + 3*t7 + 2)>>2;
 }
 
+static void pred4x4_down_left_rv40_c(uint8_t *src, uint8_t *left, uint8_t *topright, int stride){
+    LOAD_TOP_EDGE
+    LOAD_TOP_RIGHT_EDGE
+    LOAD_LEFT_EDGE
+    LOAD_DOWN_LEFT_EDGE
+
+    src[0+0*stride]=(t0 + t2 + 2*t1 + 2 + l0 + l2 + 2*l1 + 2)>>3;
+    src[1+0*stride]=
+    src[0+1*stride]=(t1 + t3 + 2*t2 + 2 + l1 + l3 + 2*l2 + 2)>>3;
+    src[2+0*stride]=
+    src[1+1*stride]=
+    src[0+2*stride]=(t2 + t4 + 2*t3 + 2 + l2 + l4 + 2*l3 + 2)>>3;
+    src[3+0*stride]=
+    src[2+1*stride]=
+    src[1+2*stride]=
+    src[0+3*stride]=(t3 + t5 + 2*t4 + 2 + l3 + l5 + 2*l4 + 2)>>3;
+    src[3+1*stride]=
+    src[2+2*stride]=
+    src[1+3*stride]=(t4 + t6 + 2*t5 + 2 + l4 + l6 + 2*l5 + 2)>>3;
+    src[3+2*stride]=
+    src[2+3*stride]=(t5 + t7 + 2*t6 + 2 + l5 + l7 + 2*l6 + 2)>>3;
+    src[3+3*stride]=(t6 + 3*t7 + 2 + l6 + 3*l7 + 2)>>3;
+}
+
+static void pred4x4_down_left_rv40_notop_c(uint8_t *src, uint8_t *left, uint8_t *topright, int stride){
+    LOAD_LEFT_EDGE
+    LOAD_DOWN_LEFT_EDGE
+
+    src[0+0*stride]=(l0 + l2 + 2*l1 + 2)>>2;
+    src[1+0*stride]=
+    src[0+1*stride]=(l1 + l3 + 2*l2 + 2)>>2;
+    src[2+0*stride]=
+    src[1+1*stride]=
+    src[0+2*stride]=(l2 + l4 + 2*l3 + 2)>>2;
+    src[3+0*stride]=
+    src[2+1*stride]=
+    src[1+2*stride]=
+    src[0+3*stride]=(l3 + l5 + 2*l4 + 2)>>2;
+    src[3+1*stride]=
+    src[2+2*stride]=
+    src[1+3*stride]=(l4 + l6 + 2*l5 + 2)>>2;
+    src[3+2*stride]=
+    src[2+3*stride]=(l5 + l7 + 2*l6 + 2)>>2;
+    src[3+3*stride]=(l6 + 3*l7 + 2)>>2;
+}
+
+static void pred4x4_down_left_rv40_nodown_c(uint8_t *src, uint8_t *left, uint8_t *topright, int stride){
+    LOAD_TOP_EDGE
+    LOAD_TOP_RIGHT_EDGE
+    LOAD_LEFT_EDGE
+
+    src[0+0*stride]=(t0 + t2 + 2*t1 + 2 + l0 + l2 + 2*l1 + 2)>>3;
+    src[1+0*stride]=
+    src[0+1*stride]=(t1 + t3 + 2*t2 + 2 + l1 + l3 + 2*l2 + 2)>>3;
+    src[2+0*stride]=
+    src[1+1*stride]=
+    src[0+2*stride]=(t2 + t4 + 2*t3 + 2 + l2 + 3*l3 + 2)>>3;
+    src[3+0*stride]=
+    src[2+1*stride]=
+    src[1+2*stride]=
+    src[0+3*stride]=(t3 + t5 + 2*t4 + 2 + l3*4 + 2)>>3;
+    src[3+1*stride]=
+    src[2+2*stride]=
+    src[1+3*stride]=(t4 + t6 + 2*t5 + 2 + l3*4 + 2)>>3;
+    src[3+2*stride]=
+    src[2+3*stride]=(t5 + t7 + 2*t6 + 2 + l3*4 + 2)>>3;
+    src[3+3*stride]=(t6 + 3*t7 + 2 + l3*4 + 2)>>3;
+}
+
 static void pred4x4_vertical_right_c(uint8_t *src, uint8_t *left, uint8_t *topright, int stride){
     const int lt= src[-1-1*stride];
     LOAD_TOP_EDGE
@@ -760,6 +835,9 @@ void ff_h264_pred_init(H264PredContext *
     h->pred4x4[LEFT_DC_PRED        ]= pred4x4_left_dc_c;
     h->pred4x4[TOP_DC_PRED         ]= pred4x4_top_dc_c;
     h->pred4x4[DC_128_PRED         ]= pred4x4_128_dc_c;
+    h->pred4x4[DIAG_DOWN_LEFT_PRED_RV40]= pred4x4_down_left_rv40_c;
+    h->pred4x4[DIAG_DOWN_LEFT_PRED_RV40_NODOWN]= pred4x4_down_left_rv40_nodown_c;
+    h->pred4x4[DIAG_DOWN_LEFT_PRED_RV40_NOTOP]= pred4x4_down_left_rv40_notop_c;
 
     h->pred8x8l[VERT_PRED           ]= pred8x8l_vertical_c;
     h->pred8x8l[HOR_PRED            ]= pred8x8l_horizontal_c;

Modified: rv40/h264pred.h
==============================================================================
--- rv40/h264pred.h	(original)
+++ rv40/h264pred.h	Sun Jul 29 10:00:11 2007
@@ -48,6 +48,9 @@
 #define TOP_DC_PRED           10
 #define DC_128_PRED           11
 
+#define DIAG_DOWN_LEFT_PRED_RV40          12
+#define DIAG_DOWN_LEFT_PRED_RV40_NODOWN   13
+#define DIAG_DOWN_LEFT_PRED_RV40_NOTOP    14
 
 #define DC_PRED8x8            0
 #define HOR_PRED8x8           1
@@ -63,7 +66,7 @@
  * Context for storing H.264 prediction functions
  */
 typedef struct H264PredContext{
-    void (*pred4x4  [9+3])(uint8_t *src, uint8_t *left, uint8_t *topright, int stride);//FIXME move to dsp?
+    void (*pred4x4  [9+3+3])(uint8_t *src, uint8_t *left, uint8_t *topright, int stride);//FIXME move to dsp?
     void (*pred8x8l [9+3])(uint8_t *src, int topleft, int topright, int stride);
     void (*pred8x8  [4+3])(uint8_t *src, int stride);
     void (*pred16x16[4+3])(uint8_t *src, int stride);

Modified: rv40/rv40.c
==============================================================================
--- rv40/rv40.c	(original)
+++ rv40/rv40.c	Sun Jul 29 10:00:11 2007
@@ -651,7 +651,7 @@ static int rv40_decode_mb_info(RV40DecCo
 
 /** Mapping of RV40 intra prediction types to standard H.264 types */
 static const int ittrans[9] = {
- DC_PRED, VERT_PRED, HOR_PRED, DIAG_DOWN_RIGHT_PRED, DIAG_DOWN_LEFT_PRED,
+ DC_PRED, VERT_PRED, HOR_PRED, DIAG_DOWN_RIGHT_PRED, DIAG_DOWN_LEFT_PRED_RV40,
  VERT_RIGHT_PRED, VERT_LEFT_PRED, HOR_UP_PRED, HOR_DOWN_PRED,
 };
 
@@ -681,10 +681,13 @@ static void rv40_output_macroblock(RV40D
                 else if(no_up){
                     if(itype == VERT_PRED) itype = HOR_PRED;
                     if(itype == DC_PRED)   itype = LEFT_DC_PRED;
+                    if(itype == DIAG_DOWN_LEFT_PRED_RV40) itype = DIAG_DOWN_LEFT_PRED_RV40_NOTOP;
                 }else if(no_left){
                     if(itype == HOR_PRED)  itype = VERT_PRED;
                     if(itype == DC_PRED)   itype = TOP_DC_PRED;
+                    if(itype == DIAG_DOWN_LEFT_PRED_RV40) itype = DIAG_DOWN_LEFT_PRED;
                 }
+                if((i || j==3) && itype == DIAG_DOWN_LEFT_PRED_RV40) itype = DIAG_DOWN_LEFT_PRED_RV40_NODOWN;
                 PY = YY - s->linesize + 4;
                 if(j && i == 3){
                     topleft = YY[-s->linesize + 3] * 0x01010101;



More information about the FFmpeg-soc mailing list