diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2006-01-08 01:50:34 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2006-01-08 01:50:34 +0000 |
commit | 80e44bc3bf31ead00fe3df3d1bf2a197cd0856d8 (patch) | |
tree | c0dd5ffec14e20008aaf097d39837258df28e078 /libavcodec/dsputil.c | |
parent | 51bb91cb2412da024a9dd0ebce3c22f52eee7ec9 (diff) | |
download | ffmpeg-80e44bc3bf31ead00fe3df3d1bf2a197cd0856d8.tar.gz |
use h264 MC functions for 2xX Xx2 blocks in snow too
Originally committed as revision 4824 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/dsputil.c')
-rw-r--r-- | libavcodec/dsputil.c | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c index 3587ebf8b2..c7ae725c6f 100644 --- a/libavcodec/dsputil.c +++ b/libavcodec/dsputil.c @@ -1487,6 +1487,17 @@ H264_CHROMA_MC(avg_ , op_avg) #undef op_avg #undef op_put +static inline void copy_block2(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h) +{ + int i; + for(i=0; i<h; i++) + { + ST16(dst , LD16(src )); + dst+=dstStride; + src+=srcStride; + } +} + static inline void copy_block4(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h) { int i; @@ -2052,6 +2063,68 @@ QPEL_MC(0, avg_ , _ , op_avg) #if 1 #define H264_LOWPASS(OPNAME, OP, OP2) \ +static void OPNAME ## h264_qpel2_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\ + const int h=2;\ + uint8_t *cm = cropTbl + MAX_NEG_CROP;\ + int i;\ + for(i=0; i<h; i++)\ + {\ + OP(dst[0], (src[0]+src[1])*20 - (src[-1]+src[2])*5 + (src[-2]+src[3]));\ + OP(dst[1], (src[1]+src[2])*20 - (src[0 ]+src[3])*5 + (src[-1]+src[4]));\ + dst+=dstStride;\ + src+=srcStride;\ + }\ +}\ +\ +static void OPNAME ## h264_qpel2_v_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\ + const int w=2;\ + uint8_t *cm = cropTbl + MAX_NEG_CROP;\ + int i;\ + for(i=0; i<w; i++)\ + {\ + const int srcB= src[-2*srcStride];\ + const int srcA= src[-1*srcStride];\ + const int src0= src[0 *srcStride];\ + const int src1= src[1 *srcStride];\ + const int src2= src[2 *srcStride];\ + const int src3= src[3 *srcStride];\ + const int src4= src[4 *srcStride];\ + OP(dst[0*dstStride], (src0+src1)*20 - (srcA+src2)*5 + (srcB+src3));\ + OP(dst[1*dstStride], (src1+src2)*20 - (src0+src3)*5 + (srcA+src4));\ + dst++;\ + src++;\ + }\ +}\ +\ +static void OPNAME ## h264_qpel2_hv_lowpass(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\ + const int h=2;\ + const int w=2;\ + uint8_t *cm = cropTbl + MAX_NEG_CROP;\ + int i;\ + src -= 2*srcStride;\ + for(i=0; i<h+5; i++)\ + {\ + tmp[0]= (src[0]+src[1])*20 - (src[-1]+src[2])*5 + (src[-2]+src[3]);\ + tmp[1]= (src[1]+src[2])*20 - (src[0 ]+src[3])*5 + (src[-1]+src[4]);\ + tmp+=tmpStride;\ + src+=srcStride;\ + }\ + tmp -= tmpStride*(h+5-2);\ + for(i=0; i<w; i++)\ + {\ + const int tmpB= tmp[-2*tmpStride];\ + const int tmpA= tmp[-1*tmpStride];\ + const int tmp0= tmp[0 *tmpStride];\ + const int tmp1= tmp[1 *tmpStride];\ + const int tmp2= tmp[2 *tmpStride];\ + const int tmp3= tmp[3 *tmpStride];\ + const int tmp4= tmp[4 *tmpStride];\ + OP2(dst[0*dstStride], (tmp0+tmp1)*20 - (tmpA+tmp2)*5 + (tmpB+tmp3));\ + OP2(dst[1*dstStride], (tmp1+tmp2)*20 - (tmp0+tmp3)*5 + (tmpA+tmp4));\ + dst++;\ + tmp++;\ + }\ +}\ static void OPNAME ## h264_qpel4_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\ const int h=4;\ uint8_t *cm = cropTbl + MAX_NEG_CROP;\ @@ -2398,6 +2471,7 @@ static void OPNAME ## h264_qpel ## SIZE ## _mc32_c(uint8_t *dst, uint8_t *src, i H264_LOWPASS(put_ , op_put, op2_put) H264_LOWPASS(avg_ , op_avg, op2_avg) +H264_MC(put_, 2) H264_MC(put_, 4) H264_MC(put_, 8) H264_MC(put_, 16) @@ -3879,6 +3953,7 @@ void dsputil_init(DSPContext* c, AVCodecContext *avctx) dspfunc(put_h264_qpel, 0, 16); dspfunc(put_h264_qpel, 1, 8); dspfunc(put_h264_qpel, 2, 4); + dspfunc(put_h264_qpel, 3, 2); dspfunc(avg_h264_qpel, 0, 16); dspfunc(avg_h264_qpel, 1, 8); dspfunc(avg_h264_qpel, 2, 4); |