[FFmpeg-devel] [PATCH] Add one spatial prediction mode for RV3/4

Kostya kostya.shishkov
Sun Dec 16 15:05:57 CET 2007


I've omitted this special case of spatial prediction fo RV30/40.
It is a bit braindamaged but needed to work as specified.
-------------- next part --------------
Index: libavcodec/rv34.c
===================================================================
--- libavcodec/rv34.c	(revision 11230)
+++ libavcodec/rv34.c	(working copy)
@@ -766,6 +766,7 @@
     if(!down){
         if(itype == DIAG_DOWN_LEFT_PRED) itype = DIAG_DOWN_LEFT_PRED_RV40_NODOWN;
         if(itype == HOR_UP_PRED) itype = HOR_UP_PRED_RV40_NODOWN;
+        if(itype == VERT_LEFT_PRED) itype = VERT_LEFT_PRED_RV40_NODOWN;
     }
     if(!right && up){
         topleft = dst[-stride + 3] * 0x01010101;
Index: libavcodec/h264pred.c
===================================================================
--- libavcodec/h264pred.c	(revision 11230)
+++ libavcodec/h264pred.c	(working copy)
@@ -292,6 +292,7 @@
     LOAD_TOP_EDGE
     LOAD_TOP_RIGHT_EDGE
     LOAD_LEFT_EDGE
+    LOAD_DOWN_LEFT_EDGE
 
     src[0+0*stride]=(2*t0 + 2*t1 + l1 + 2*l2 + l3 + 4)>>3;
     src[1+0*stride]=
@@ -301,6 +302,29 @@
     src[3+0*stride]=
     src[2+2*stride]=(t3 + t4+ 1)>>1;
     src[3+2*stride]=(t4 + t5+ 1)>>1;
+    src[0+1*stride]=(t0 + 2*t1 + t2 + l2 + 2*l3 + l4 + 4)>>3;
+    src[1+1*stride]=
+    src[0+3*stride]=(t1 + 2*t2 + t3 + 2)>>2;
+    src[2+1*stride]=
+    src[1+3*stride]=(t2 + 2*t3 + t4 + 2)>>2;
+    src[3+1*stride]=
+    src[2+3*stride]=(t3 + 2*t4 + t5 + 2)>>2;
+    src[3+3*stride]=(t4 + 2*t5 + t6 + 2)>>2;
+}
+
+static void pred4x4_vertical_left_rv40_nodown_c(uint8_t *src, uint8_t *topright, int stride){
+    LOAD_TOP_EDGE
+    LOAD_TOP_RIGHT_EDGE
+    LOAD_LEFT_EDGE
+
+    src[0+0*stride]=(2*t0 + 2*t1 + l1 + 2*l2 + l3 + 4)>>3;
+    src[1+0*stride]=
+    src[0+2*stride]=(t1 + t2 + 1)>>1;
+    src[2+0*stride]=
+    src[1+2*stride]=(t2 + t3 + 1)>>1;
+    src[3+0*stride]=
+    src[2+2*stride]=(t3 + t4+ 1)>>1;
+    src[3+2*stride]=(t4 + t5+ 1)>>1;
     src[0+1*stride]=(t0 + 2*t1 + t2 + l2 + 2*l3 + l3 + 4)>>3;
     src[1+1*stride]=
     src[0+3*stride]=(t1 + 2*t2 + t3 + 2)>>2;
@@ -1010,6 +1034,7 @@
         h->pred4x4[DC_128_PRED         ]= pred4x4_128_dc_c;
         h->pred4x4[DIAG_DOWN_LEFT_PRED_RV40_NODOWN]= pred4x4_down_left_rv40_nodown_c;
         h->pred4x4[HOR_UP_PRED_RV40_NODOWN]= pred4x4_horizontal_up_rv40_nodown_c;
+        h->pred4x4[VERT_LEFT_PRED_RV40_NODOWN]= pred4x4_vertical_left_rv40_nodown_c;
     }
 
     h->pred8x8l[VERT_PRED           ]= pred8x8l_vertical_c;
Index: libavcodec/h264pred.h
===================================================================
--- libavcodec/h264pred.h	(revision 11230)
+++ libavcodec/h264pred.h	(working copy)
@@ -50,6 +50,7 @@
 
 #define DIAG_DOWN_LEFT_PRED_RV40_NODOWN   12
 #define HOR_UP_PRED_RV40_NODOWN           13
+#define VERT_LEFT_PRED_RV40_NODOWN        14
 
 #define DC_PRED8x8            0
 #define HOR_PRED8x8           1
@@ -65,7 +66,7 @@
  * Context for storing H.264 prediction functions
  */
 typedef struct H264PredContext{
-    void (*pred4x4  [9+3+2])(uint8_t *src, uint8_t *topright, int stride);//FIXME move to dsp?
+    void (*pred4x4  [9+3+3])(uint8_t *src, 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);



More information about the ffmpeg-devel mailing list