H.264 / AVC / MPEG-4 part10 prediction functions.
More...
#include "libavutil/intreadwrite.h"
#include "mathops.h"
#include "bit_depth_template.c"
|
| #define | LOAD_TOP_RIGHT_EDGE |
| |
| #define | LOAD_DOWN_LEFT_EDGE |
| |
| #define | LOAD_LEFT_EDGE |
| |
| #define | LOAD_TOP_EDGE |
| |
| #define | PREDICT_16x16_DC(v) |
| |
| #define | PRED16x16_X(n, v) |
| |
| #define | PRED8x8_X(n, v) |
| |
|
#define | SRC(x, y) src[(x)+(y)*stride] |
| |
|
#define | PL(y) const int l##y = (SRC(-1,y-1) + 2*SRC(-1,y) + SRC(-1,y+1) + 2) >> 2; |
| |
| #define | PREDICT_8x8_LOAD_LEFT |
| |
|
#define | PT(x) const int t##x = (SRC(x-1,-1) + 2*SRC(x,-1) + SRC(x+1,-1) + 2) >> 2; |
| |
| #define | PREDICT_8x8_LOAD_TOP |
| |
|
#define | PTR(x) t##x = (SRC(x-1,-1) + 2*SRC(x,-1) + SRC(x+1,-1) + 2) >> 2; |
| |
| #define | PREDICT_8x8_LOAD_TOPRIGHT |
| |
|
#define | PREDICT_8x8_LOAD_TOPLEFT const int lt = (SRC(-1,0) + 2*SRC(-1,-1) + SRC(0,-1) + 2) >> 2 |
| |
| #define | PREDICT_8x8_DC(v) |
| |
| #define | ROW(y) |
| |
|
|
| PRED16x16_X (127,(1<<(BIT_DEPTH-1)) -1) PRED16x16_X(128 |
| |
|
| for (j=16;j >0;--j) |
| |
|
| PRED8x8_X (127,(1<<(BIT_DEPTH-1)) -1) PRED8x8_X(128 |
| |
|
| for (i=0;i< 4;i++) |
| |
|
|
<<(BIT_DEPTH-1))+0) PRED16x16_X(129,(1<<(BIT_DEPTH-1))+1) static inline void FUNCC(pred16x16_plane_compat)(uint8_t *_src, ptrdiff_t _stride, const int svq3, const int rv40) { int i, j, k;int a;INIT_CLIP pixel *src=(pixel *) _src;int stride=_stride >>(sizeof(pixel) -1);const pixel *const src0=src+7-stride;const pixel *src1=src+8 *stride-1;const pixel *src2=src1-2 *stride;int H=src0[1] - src0[-1];int V=src1[0] - src2[0];for(k=2;k<=8;++k) { src1+=stride;src2 -=stride;H+=k *(src0[k] - src0[-k]);V+=k *(src1[0] - src2[0]);} if(svq3){ H=(5 *(H/4))/16;V=(5 *(V/4))/16;i=H;H=V;V=i;}else if(rv40){ H=(H+(H >> | V = ( V + (V>>2) ) >> 4 |
| |
| | else |
| |
|
| a = 16*(src1[0] + src2[16] + 1) - 7*(V+H) |
| |
|
<<(BIT_DEPTH-1))+0) PRED8x8_X(129,(1<<(BIT_DEPTH-1))+1) static void FUNCC(pred8x16_128_dc)(uint8_t *_src, ptrdiff_t stride) { FUNCC(pred8x8_128_dc)(_src, stride);FUNCC(pred8x8_128_dc)(_src+8 *stride, stride);} static void FUNCC(pred8x8_left_dc)(uint8_t *_src, ptrdiff_t stride) { int i;int dc0, dc2;pixel4 dc0splat, dc2splat;pixel *src=(pixel *) _src;stride >>=sizeof(pixel) -1;dc0=dc2=0;for(i=0;i< 4;i++){ dc0+=src[-1+i *stride];dc2+=src[-1+(i+4) *stride];} dc0splat=PIXEL_SPLAT_X4((dc0+2)>> | dc2splat = PIXEL_SPLAT_X4((dc2 + 2)>>2) |
| |
H.264 / AVC / MPEG-4 part10 prediction functions.
- Author
- Michael Niedermayer micha.nosp@m.elni.nosp@m.@gmx..nosp@m.at
§ LOAD_DOWN_LEFT_EDGE
| #define LOAD_DOWN_LEFT_EDGE |
Value:const unsigned av_unused l4 = src[-1+4*stride];\
const unsigned av_unused l5 = src[-1+5*stride];\
const unsigned av_unused l6 = src[-1+6*stride];\
const unsigned av_unused l7 = src[-1+7*stride];\
§ LOAD_LEFT_EDGE
Value:const unsigned av_unused l0 = src[-1+0*stride];\
const unsigned av_unused l1 = src[-1+1*stride];\
const unsigned av_unused l2 = src[-1+2*stride];\
const unsigned av_unused l3 = src[-1+3*stride];\
§ LOAD_TOP_EDGE
Value:const unsigned av_unused t0 = src[ 0-1*stride];\
const unsigned av_unused t1 = src[ 1-1*stride];\
const unsigned av_unused t2 = src[ 2-1*stride];\
const unsigned av_unused t3 = src[ 3-1*stride];\
§ LOAD_TOP_RIGHT_EDGE
| #define LOAD_TOP_RIGHT_EDGE |
Value:const unsigned av_unused t4 = topright[0];\
const unsigned av_unused t5 = topright[1];\
const unsigned av_unused t6 = topright[2];\
const unsigned av_unused t7 = topright[3];\
§ PRED16x16_X
| #define PRED16x16_X |
( |
|
n, |
|
|
|
v |
|
) |
| |
Value:static void FUNCC(pred16x16_##n##_dc)(uint8_t *_src, ptrdiff_t stride)\
{\
int i;\
pixel *src = (pixel*)_src;\
stride >>= sizeof(pixel)-1;\
PREDICT_16x16_DC(PIXEL_SPLAT_X4(v));\
}
§ PRED8x8_X
| #define PRED8x8_X |
( |
|
n, |
|
|
|
v |
|
) |
| |
Value:static void FUNCC(pred8x8_##n##_dc)(uint8_t *_src, ptrdiff_t stride)\
{\
int i;\
const pixel4 a = PIXEL_SPLAT_X4(v);\
pixel *src = (pixel*)_src;\
stride >>= sizeof(pixel)-1;\
for(i=0; i<8; i++){\
AV_WN4PA(((pixel4*)(src+i*stride))+0, a);\
AV_WN4PA(((pixel4*)(src+i*stride))+1, a);\
}\
}
§ PREDICT_16x16_DC
| #define PREDICT_16x16_DC |
( |
|
v | ) |
|
Value:for(i=0; i<16; i++){\
AV_WN4PA(src+ 0, v);\
AV_WN4PA(src+ 4, v);\
AV_WN4PA(src+ 8, v);\
AV_WN4PA(src+12, v);\
src += stride;\
}
§ PREDICT_8x8_DC
| #define PREDICT_8x8_DC |
( |
|
v | ) |
|
Value:int y; \
for( y = 0; y < 8; y++ ) { \
AV_WN4PA(((pixel4*)src)+0, v); \
AV_WN4PA(((pixel4*)src)+1, v); \
src += stride; \
}
§ PREDICT_8x8_LOAD_LEFT
| #define PREDICT_8x8_LOAD_LEFT |
Value:const int l0 = ((has_topleft ? SRC(-1,-1) : SRC(-1,0)) \
+ 2*SRC(-1,0) + SRC(-1,1) + 2) >> 2; \
PL(1) PL(2) PL(3) PL(4) PL(5) PL(6) \
const int l7 av_unused = (SRC(-1,6) + 3*SRC(-1,7) + 2) >> 2
§ PREDICT_8x8_LOAD_TOP
| #define PREDICT_8x8_LOAD_TOP |
Value:const int t0 = ((has_topleft ? SRC(-1,-1) : SRC(0,-1)) \
+ 2*SRC(0,-1) + SRC(1,-1) + 2) >> 2; \
PT(1) PT(2) PT(3) PT(4) PT(5) PT(6) \
const int t7 av_unused = ((has_topright ? SRC(8,-1) : SRC(7,-1)) \
+ 2*SRC(7,-1) + SRC(6,-1) + 2) >> 2
§ PREDICT_8x8_LOAD_TOPRIGHT
| #define PREDICT_8x8_LOAD_TOPRIGHT |
Value:int t8, t9, t10, t11, t12, t13, t14, t15; \
if(has_topright) { \
PTR(8) PTR(9) PTR(10) PTR(11) PTR(12) PTR(13) PTR(14) \
t15 = (SRC(14,-1) + 3*SRC(15,-1) + 2) >> 2; \
} else t8=t9=t10=t11=t12=t13=t14=t15= SRC(7,-1);
§ ROW
Value:a = PIXEL_SPLAT_X4(l##y); \
AV_WN4PA(src+y*stride, a); \
AV_WN4PA(src+y*stride+4, a);
§ else