nengel@2: /* nengel@2: * Copyright (c) 2009 TUDelft nengel@2: * nengel@2: * Cell Parallel SPU - 2DWave Macroblock Decoding. nengel@2: */ nengel@2: nengel@2: /** nengel@2: * @file libavcodec/cell/spu/h264_main_spu.c nengel@2: * Cell Parallel SPU - 2DWave Macroblock Decoding nengel@2: * @author C C Chi nengel@2: * nengel@2: * SIMD SPU kernels nengel@2: * H.264/AVC motion compensation nengel@2: * @author Mauricio Alvarez nengel@2: * @author Albert Paradis nengel@2: */ nengel@2: nengel@2: nengel@2: #include "dsputil_spu.h" nengel@2: #include "h264_idct_spu.h" nengel@2: #include "h264_deblock_spu.h" nengel@2: #include "types_spu.h" nengel@2: #include "libavutil/intreadwrite.h" nengel@2: nengel@2: #include nengel@2: #include nengel@2: #include nengel@2: #include nengel@2: nengel@2: //Luma interpolation nengel@2: #define PUT_OP_U8_SPU(d, s, dst) (void) dst; d = s nengel@2: #define AVG_OP_U8_SPU(d, s, dst) d = spu_avg(dst, s) nengel@2: nengel@2: #define OP_U8_SPU PUT_OP_U8_SPU nengel@2: #define PREFIX_h264_qpel16_h_lowpass_spu put_h264_qpel16_h_lowpass_spu nengel@2: #define PREFIX_h264_qpel16_v_lowpass_spu put_h264_qpel16_v_lowpass_spu nengel@2: #define PREFIX_h264_qpel16_hv_lowpass_spu put_h264_qpel16_hv_lowpass_spu nengel@2: #define PREFIX_h264_qpel8_h_lowpass_spu put_h264_qpel8_h_lowpass_spu nengel@2: #define PREFIX_h264_qpel8_v_lowpass_spu put_h264_qpel8_v_lowpass_spu nengel@2: #define PREFIX_h264_qpel8_hv_lowpass_spu put_h264_qpel8_hv_lowpass_spu nengel@2: #define PREFIX_h264_qpel4_h_lowpass_spu put_h264_qpel4_h_lowpass_spu nengel@2: #define PREFIX_h264_qpel4_v_lowpass_spu put_h264_qpel4_v_lowpass_spu nengel@2: #define PREFIX_h264_qpel4_hv_lowpass_spu put_h264_qpel4_hv_lowpass_spu nengel@2: #include "h264_luma_template_spu.c" nengel@2: #undef OP_U8_SPU nengel@2: #undef PREFIX_h264_qpel16_h_lowpass_spu nengel@2: #undef PREFIX_h264_qpel16_v_lowpass_spu nengel@2: #undef PREFIX_h264_qpel16_hv_lowpass_spu nengel@2: #undef PREFIX_h264_qpel8_h_lowpass_spu nengel@2: #undef PREFIX_h264_qpel8_v_lowpass_spu nengel@2: #undef PREFIX_h264_qpel8_hv_lowpass_spu nengel@2: #undef PREFIX_h264_qpel4_h_lowpass_spu nengel@2: #undef PREFIX_h264_qpel4_v_lowpass_spu nengel@2: #undef PREFIX_h264_qpel4_hv_lowpass_spu nengel@2: nengel@2: #define OP_U8_SPU AVG_OP_U8_SPU nengel@2: #define PREFIX_h264_qpel16_h_lowpass_spu avg_h264_qpel16_h_lowpass_spu nengel@2: #define PREFIX_h264_qpel16_v_lowpass_spu avg_h264_qpel16_v_lowpass_spu nengel@2: #define PREFIX_h264_qpel16_hv_lowpass_spu avg_h264_qpel16_hv_lowpass_spu nengel@2: #define PREFIX_h264_qpel8_h_lowpass_spu avg_h264_qpel8_h_lowpass_spu nengel@2: #define PREFIX_h264_qpel8_v_lowpass_spu avg_h264_qpel8_v_lowpass_spu nengel@2: #define PREFIX_h264_qpel8_hv_lowpass_spu avg_h264_qpel8_hv_lowpass_spu nengel@2: #define PREFIX_h264_qpel4_h_lowpass_spu avg_h264_qpel4_h_lowpass_spu nengel@2: #define PREFIX_h264_qpel4_v_lowpass_spu avg_h264_qpel4_v_lowpass_spu nengel@2: #define PREFIX_h264_qpel4_hv_lowpass_spu avg_h264_qpel4_hv_lowpass_spu nengel@2: #include "h264_luma_template_spu.c" nengel@2: #undef OP_U8_SPU nengel@2: #undef PREFIX_h264_qpel16_h_lowpass_spu nengel@2: #undef PREFIX_h264_qpel16_v_lowpass_spu nengel@2: #undef PREFIX_h264_qpel16_hv_lowpass_spu nengel@2: #undef PREFIX_h264_qpel8_h_lowpass_spu nengel@2: #undef PREFIX_h264_qpel8_v_lowpass_spu nengel@2: #undef PREFIX_h264_qpel8_hv_lowpass_spu nengel@2: #undef PREFIX_h264_qpel4_h_lowpass_spu nengel@2: #undef PREFIX_h264_qpel4_v_lowpass_spu nengel@2: #undef PREFIX_h264_qpel4_hv_lowpass_spu nengel@2: nengel@2: #define H264_MC(OPNAME, SIZE, CODETYPE) \ nengel@2: static void OPNAME ## h264_qpel ## SIZE ## _mc00_ ## CODETYPE(uint8_t *dst, uint8_t *src, int dst_stride, int h){\ nengel@2: OPNAME ## pixels ## SIZE ## _ ## CODETYPE(dst, src, dst_stride, STRIDE_Y, h);\ nengel@2: }\ nengel@2: \ nengel@2: static void OPNAME ## h264_qpel ## SIZE ## _mc10_ ## CODETYPE(uint8_t *dst, uint8_t *src, int dst_stride, int h){ \ nengel@2: DECLARE_ALIGNED_16(uint8_t, half[16*16]);\ nengel@2: put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(half, src, 16, h);\ nengel@2: OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, src, half, dst_stride, STRIDE_Y, h);\ nengel@2: }\ nengel@2: \ nengel@2: static void OPNAME ## h264_qpel ## SIZE ## _mc20_ ## CODETYPE(uint8_t *dst, uint8_t *src, int dst_stride, int h){\ nengel@2: OPNAME ## h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(dst, src, dst_stride, h);\ nengel@2: }\ nengel@2: \ nengel@2: static void OPNAME ## h264_qpel ## SIZE ## _mc30_ ## CODETYPE(uint8_t *dst, uint8_t *src, int dst_stride, int h){\ nengel@2: DECLARE_ALIGNED_16(uint8_t, half[16*16]);\ nengel@2: put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(half, src, 16, h);\ nengel@2: OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, src+1, half, dst_stride, STRIDE_Y, h);\ nengel@2: }\ nengel@2: \ nengel@2: static void OPNAME ## h264_qpel ## SIZE ## _mc01_ ## CODETYPE(uint8_t *dst, uint8_t *src, int dst_stride, int h){\ nengel@2: DECLARE_ALIGNED_16(uint8_t, half[16*16]);\ nengel@2: put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(half, src, 16, h);\ nengel@2: OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, src, half, dst_stride, STRIDE_Y, h);\ nengel@2: }\ nengel@2: \ nengel@2: static void OPNAME ## h264_qpel ## SIZE ## _mc02_ ## CODETYPE(uint8_t *dst, uint8_t *src, int dst_stride, int h){\ nengel@2: OPNAME ## h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(dst, src, dst_stride, h);\ nengel@2: }\ nengel@2: \ nengel@2: static void OPNAME ## h264_qpel ## SIZE ## _mc03_ ## CODETYPE(uint8_t *dst, uint8_t *src, int dst_stride, int h){\ nengel@2: DECLARE_ALIGNED_16(uint8_t, half[16*16]);\ nengel@2: put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(half, src, 16, h);\ nengel@2: OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, src+STRIDE_Y, half, dst_stride, STRIDE_Y, h);\ nengel@2: }\ nengel@2: \ nengel@2: static void OPNAME ## h264_qpel ## SIZE ## _mc11_ ## CODETYPE(uint8_t *dst, uint8_t *src, int dst_stride, int h){\ nengel@2: DECLARE_ALIGNED_16(uint8_t, halfH[16*16]);\ nengel@2: DECLARE_ALIGNED_16(uint8_t, halfV[16*16]);\ nengel@2: put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(halfH, src, 16, h);\ nengel@2: put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(halfV, src, 16, h);\ nengel@2: OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfH, halfV, dst_stride, 16, h);\ nengel@2: }\ nengel@2: \ nengel@2: static void OPNAME ## h264_qpel ## SIZE ## _mc31_ ## CODETYPE(uint8_t *dst, uint8_t *src, int dst_stride, int h){\ nengel@2: DECLARE_ALIGNED_16(uint8_t, halfH[16*16]);\ nengel@2: DECLARE_ALIGNED_16(uint8_t, halfV[16*16]);\ nengel@2: put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(halfH, src, 16, h);\ nengel@2: put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(halfV, src+1, 16, h);\ nengel@2: OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfH, halfV, dst_stride, 16, h);\ nengel@2: }\ nengel@2: \ nengel@2: static void OPNAME ## h264_qpel ## SIZE ## _mc13_ ## CODETYPE(uint8_t *dst, uint8_t *src, int dst_stride, int h){\ nengel@2: DECLARE_ALIGNED_16(uint8_t, halfH[16*16]);\ nengel@2: DECLARE_ALIGNED_16(uint8_t, halfV[16*16]);\ nengel@2: put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(halfH, src + STRIDE_Y, 16, h);\ nengel@2: put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(halfV, src, 16, h);\ nengel@2: OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfH, halfV, dst_stride, 16, h);\ nengel@2: }\ nengel@2: \ nengel@2: static void OPNAME ## h264_qpel ## SIZE ## _mc33_ ## CODETYPE(uint8_t *dst, uint8_t *src, int dst_stride, int h){\ nengel@2: DECLARE_ALIGNED_16(uint8_t, halfH[16*16]);\ nengel@2: DECLARE_ALIGNED_16(uint8_t, halfV[16*16]);\ nengel@2: put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(halfH, src + STRIDE_Y, 16, h);\ nengel@2: put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(halfV, src+1, 16, h);\ nengel@2: OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfH, halfV, dst_stride, 16, h);\ nengel@2: }\ nengel@2: \ nengel@2: static void OPNAME ## h264_qpel ## SIZE ## _mc22_ ## CODETYPE(uint8_t *dst, uint8_t *src, int dst_stride, int h){\ nengel@2: DECLARE_ALIGNED_16(int16_t, tmp[16*(16+8)]);\ nengel@2: OPNAME ## h264_qpel ## SIZE ## _hv_lowpass_ ## CODETYPE(dst, tmp, src, dst_stride, 16, h);\ nengel@2: }\ nengel@2: \ nengel@2: static void OPNAME ## h264_qpel ## SIZE ## _mc21_ ## CODETYPE(uint8_t *dst, uint8_t *src, int dst_stride, int h){\ nengel@2: DECLARE_ALIGNED_16(uint8_t, halfH[16*16]);\ nengel@2: DECLARE_ALIGNED_16(uint8_t, halfHV[16*16]);\ nengel@2: DECLARE_ALIGNED_16(int16_t, tmp[16*(16+8)]);\ nengel@2: put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(halfH, src, 16, h);\ nengel@2: put_h264_qpel ## SIZE ## _hv_lowpass_ ## CODETYPE(halfHV, tmp, src, 16, 16, h);\ nengel@2: OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfH, halfHV, dst_stride, 16, h);\ nengel@2: }\ nengel@2: \ nengel@2: static void OPNAME ## h264_qpel ## SIZE ## _mc23_ ## CODETYPE(uint8_t *dst, uint8_t *src, int dst_stride, int h){\ nengel@2: DECLARE_ALIGNED_16(uint8_t, halfH[16*16]);\ nengel@2: DECLARE_ALIGNED_16(uint8_t, halfHV[16*16]);\ nengel@2: DECLARE_ALIGNED_16(int16_t, tmp[16*(16+8)]);\ nengel@2: put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(halfH, src + STRIDE_Y, 16, h);\ nengel@2: put_h264_qpel ## SIZE ## _hv_lowpass_ ## CODETYPE(halfHV, tmp, src, 16, 16, h);\ nengel@2: OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfH, halfHV, dst_stride, 16, h);\ nengel@2: }\ nengel@2: \ nengel@2: static void OPNAME ## h264_qpel ## SIZE ## _mc12_ ## CODETYPE(uint8_t *dst, uint8_t *src, int dst_stride, int h){\ nengel@2: DECLARE_ALIGNED_16(uint8_t, halfV[16*16]);\ nengel@2: DECLARE_ALIGNED_16(uint8_t, halfHV[16*16]);\ nengel@2: DECLARE_ALIGNED_16(int16_t, tmp[16*(16+8)]);\ nengel@2: put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(halfV, src, 16, h);\ nengel@2: put_h264_qpel ## SIZE ## _hv_lowpass_ ## CODETYPE(halfHV, tmp, src, 16, 16, h);\ nengel@2: OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfV, halfHV, dst_stride, 16, h);\ nengel@2: }\ nengel@2: \ nengel@2: static void OPNAME ## h264_qpel ## SIZE ## _mc32_ ## CODETYPE(uint8_t *dst, uint8_t *src, int dst_stride, int h){\ nengel@2: DECLARE_ALIGNED_16(uint8_t, halfV[16*16]);\ nengel@2: DECLARE_ALIGNED_16(uint8_t, halfHV[16*16]);\ nengel@2: DECLARE_ALIGNED_16(int16_t, tmp[16*(16+8)]);\ nengel@2: put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(halfV, src+1, 16, h);\ nengel@2: put_h264_qpel ## SIZE ## _hv_lowpass_ ## CODETYPE(halfHV, tmp, src, 16, 16, h);\ nengel@2: OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfV, halfHV, dst_stride, 16, h);\ nengel@2: }\ nengel@2: nengel@2: nengel@2: /**************************/ nengel@2: /* put pixels functions */ nengel@2: /*************************/ nengel@2: nengel@2: static void put_pixels16_l2_spu( uint8_t * dst, const uint8_t * src1, nengel@2: const uint8_t * src2, int dst_stride, nengel@2: int src_stride1, int h) nengel@2: { nengel@2: int i; nengel@2: nengel@2: const int perm_src1 = (unsigned int) src1 & 15; nengel@2: nengel@2: for (i=0; i> log2_denom ) nengel@2: #define op_scale2(x) dst[x] = av_clip_uint8( (src[x]*weights + dst[x]*weightd + offset) >> (log2_denom+1)) nengel@2: #define H264_WEIGHT(W,H) \ nengel@2: static void weight_h264_pixels ## W ## x ## H ## _c(uint8_t *dst, int stride, int log2_denom, int weight, int offset){ \ nengel@2: int y; \ nengel@2: offset <<= log2_denom; \ nengel@2: if(log2_denom) offset += 1<<(log2_denom-1); \ nengel@2: for(y=0; y> 1 ) ) >> 1) - p1, -tc0[i], tc0[i] ); nengel@2: tc++; nengel@2: } nengel@2: if( FFABS( q2 - q0 ) < beta ) { nengel@2: pix[ xstride] = q1 + av_clip( (( q2 + ( ( p0 + q0 + 1 ) >> 1 ) ) >> 1) - q1, -tc0[i], tc0[i] ); nengel@2: tc++; nengel@2: } nengel@2: nengel@2: i_delta = av_clip( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc ); nengel@2: pix[-xstride] = av_clip_uint8( p0 + i_delta ); /* p0' */ nengel@2: pix[0] = av_clip_uint8( q0 - i_delta ); /* q0' */ nengel@2: } nengel@2: pix += ystride; nengel@2: } nengel@2: } nengel@2: } nengel@2: static void h264_v_loop_filter_luma_c(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0) nengel@2: { nengel@2: h264_loop_filter_luma_c(pix, stride, 1, alpha, beta, tc0); nengel@2: } nengel@2: static void h264_h_loop_filter_luma_c(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0) nengel@2: { nengel@2: h264_loop_filter_luma_c(pix, 1, stride, alpha, beta, tc0); nengel@2: } nengel@2: nengel@2: static inline void h264_loop_filter_luma_intra_c(uint8_t *pix, int xstride, int ystride, int alpha, int beta) nengel@2: { nengel@2: int d; nengel@2: for( d = 0; d < 16; d++ ) { nengel@2: const int p2 = pix[-3*xstride]; nengel@2: const int p1 = pix[-2*xstride]; nengel@2: const int p0 = pix[-1*xstride]; nengel@2: nengel@2: const int q0 = pix[ 0*xstride]; nengel@2: const int q1 = pix[ 1*xstride]; nengel@2: const int q2 = pix[ 2*xstride]; nengel@2: nengel@2: if( FFABS( p0 - q0 ) < alpha && nengel@2: FFABS( p1 - p0 ) < beta && nengel@2: FFABS( q1 - q0 ) < beta ) { nengel@2: nengel@2: if(FFABS( p0 - q0 ) < (( alpha >> 2 ) + 2 )){ nengel@2: if( FFABS( p2 - p0 ) < beta) nengel@2: { nengel@2: const int p3 = pix[-4*xstride]; nengel@2: /* p0', p1', p2' */ nengel@2: pix[-1*xstride] = ( p2 + 2*p1 + 2*p0 + 2*q0 + q1 + 4 ) >> 3; nengel@2: pix[-2*xstride] = ( p2 + p1 + p0 + q0 + 2 ) >> 2; nengel@2: pix[-3*xstride] = ( 2*p3 + 3*p2 + p1 + p0 + q0 + 4 ) >> 3; nengel@2: } else { nengel@2: /* p0' */ nengel@2: pix[-1*xstride] = ( 2*p1 + p0 + q1 + 2 ) >> 2; nengel@2: } nengel@2: if( FFABS( q2 - q0 ) < beta) nengel@2: { nengel@2: const int q3 = pix[3*xstride]; nengel@2: /* q0', q1', q2' */ nengel@2: pix[0*xstride] = ( p1 + 2*p0 + 2*q0 + 2*q1 + q2 + 4 ) >> 3; nengel@2: pix[1*xstride] = ( p0 + q0 + q1 + q2 + 2 ) >> 2; nengel@2: pix[2*xstride] = ( 2*q3 + 3*q2 + q1 + q0 + p0 + 4 ) >> 3; nengel@2: } else { nengel@2: /* q0' */ nengel@2: pix[0*xstride] = ( 2*q1 + q0 + p1 + 2 ) >> 2; nengel@2: } nengel@2: }else{ nengel@2: /* p0', q0' */ nengel@2: pix[-1*xstride] = ( 2*p1 + p0 + q1 + 2 ) >> 2; nengel@2: pix[ 0*xstride] = ( 2*q1 + q0 + p1 + 2 ) >> 2; nengel@2: } nengel@2: } nengel@2: pix += ystride; nengel@2: } nengel@2: } nengel@2: static void h264_v_loop_filter_luma_intra_c(uint8_t *pix, int stride, int alpha, int beta) nengel@2: { nengel@2: h264_loop_filter_luma_intra_c(pix, stride, 1, alpha, beta); nengel@2: } nengel@2: static void h264_h_loop_filter_luma_intra_c(uint8_t *pix, int stride, int alpha, int beta) nengel@2: { nengel@2: h264_loop_filter_luma_intra_c(pix, 1, stride, alpha, beta); nengel@2: } nengel@2: nengel@2: static inline void h264_loop_filter_chroma_c(uint8_t *pix, int xstride, int ystride, int alpha, int beta, int8_t *tc0) nengel@2: { nengel@2: int i, d; nengel@2: for( i = 0; i < 4; i++ ) { nengel@2: const int tc = tc0[i]; nengel@2: if( tc <= 0 ) { nengel@2: pix += 2*ystride; nengel@2: continue; nengel@2: } nengel@2: for( d = 0; d < 2; d++ ) { nengel@2: const int p0 = pix[-1*xstride]; nengel@2: const int p1 = pix[-2*xstride]; nengel@2: const int q0 = pix[0]; nengel@2: const int q1 = pix[1*xstride]; nengel@2: nengel@2: if( FFABS( p0 - q0 ) < alpha && nengel@2: FFABS( p1 - p0 ) < beta && nengel@2: FFABS( q1 - q0 ) < beta ) { nengel@2: nengel@2: int delta = av_clip( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc ); nengel@2: nengel@2: pix[-xstride] = av_clip_uint8( p0 + delta ); /* p0' */ nengel@2: pix[0] = av_clip_uint8( q0 - delta ); /* q0' */ nengel@2: } nengel@2: pix += ystride; nengel@2: } nengel@2: } nengel@2: } nengel@2: static void h264_v_loop_filter_chroma_c(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0) nengel@2: { nengel@2: h264_loop_filter_chroma_c(pix, stride, 1, alpha, beta, tc0); nengel@2: } nengel@2: static void h264_h_loop_filter_chroma_c(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0) nengel@2: { nengel@2: h264_loop_filter_chroma_c(pix, 1, stride, alpha, beta, tc0); nengel@2: } nengel@2: nengel@2: static inline void h264_loop_filter_chroma_intra_c(uint8_t *pix, int xstride, int ystride, int alpha, int beta) nengel@2: { nengel@2: int d; nengel@2: for( d = 0; d < 8; d++ ) { nengel@2: const int p0 = pix[-1*xstride]; nengel@2: const int p1 = pix[-2*xstride]; nengel@2: const int q0 = pix[0]; nengel@2: const int q1 = pix[1*xstride]; nengel@2: nengel@2: if( FFABS( p0 - q0 ) < alpha && nengel@2: FFABS( p1 - p0 ) < beta && nengel@2: FFABS( q1 - q0 ) < beta ) { nengel@2: nengel@2: pix[-xstride] = ( 2*p1 + p0 + q1 + 2 ) >> 2; /* p0' */ nengel@2: pix[0] = ( 2*q1 + q0 + p1 + 2 ) >> 2; /* q0' */ nengel@2: } nengel@2: pix += ystride; nengel@2: } nengel@2: } nengel@2: static void h264_v_loop_filter_chroma_intra_c(uint8_t *pix, int stride, int alpha, int beta) nengel@2: { nengel@2: h264_loop_filter_chroma_intra_c(pix, stride, 1, alpha, beta); nengel@2: } nengel@2: static void h264_h_loop_filter_chroma_intra_c(uint8_t *pix, int stride, int alpha, int beta) nengel@2: { nengel@2: h264_loop_filter_chroma_intra_c(pix, 1, stride, alpha, beta); nengel@2: } nengel@2: nengel@2: nengel@2: void dsputil_h264_init_cell(DSPContext_spu* c) { nengel@2: nengel@2: c->h264_v_loop_filter_luma= h264_v_loop_filter_luma_c; nengel@2: c->h264_h_loop_filter_luma= h264_h_loop_filter_luma_c; nengel@2: c->h264_v_loop_filter_luma_intra= h264_v_loop_filter_luma_intra_c; nengel@2: c->h264_h_loop_filter_luma_intra= h264_h_loop_filter_luma_intra_c; nengel@2: c->h264_v_loop_filter_chroma= h264_v_loop_filter_chroma_c; nengel@2: c->h264_h_loop_filter_chroma= h264_h_loop_filter_chroma_c; nengel@2: c->h264_v_loop_filter_chroma_intra= h264_v_loop_filter_chroma_intra_c; nengel@2: c->h264_h_loop_filter_chroma_intra= h264_h_loop_filter_chroma_intra_c; nengel@2: nengel@2: c->h264_idct_add[0] = h264_idct8_add_spu; nengel@2: c->h264_idct_add[1] = h264_idct4_add_spu; nengel@2: nengel@2: nengel@2: c->put_h264_chroma_pixels_tab[0] = put_h264_chroma_mc8_spu; nengel@2: c->put_h264_chroma_pixels_tab[1] = put_h264_chroma_mc4_spu; nengel@2: c->put_h264_chroma_pixels_tab[2] = put_h264_chroma_mc2_spu; nengel@2: c->avg_h264_chroma_pixels_tab[0] = avg_h264_chroma_mc8_spu; nengel@2: c->avg_h264_chroma_pixels_tab[1] = avg_h264_chroma_mc4_spu; nengel@2: c->avg_h264_chroma_pixels_tab[2] = avg_h264_chroma_mc2_spu; nengel@2: nengel@2: c->weight_h264_pixels_tab[0]= weight_h264_pixels16x16_c; nengel@2: c->weight_h264_pixels_tab[1]= weight_h264_pixels16x8_c; nengel@2: c->weight_h264_pixels_tab[2]= weight_h264_pixels8x16_c; nengel@2: c->weight_h264_pixels_tab[3]= weight_h264_pixels8x8_c; nengel@2: c->weight_h264_pixels_tab[4]= weight_h264_pixels8x4_c; nengel@2: c->weight_h264_pixels_tab[5]= weight_h264_pixels4x8_c; nengel@2: c->weight_h264_pixels_tab[6]= weight_h264_pixels4x4_c; nengel@2: c->weight_h264_pixels_tab[7]= weight_h264_pixels4x2_c; nengel@2: c->weight_h264_pixels_tab[8]= weight_h264_pixels2x4_c; nengel@2: c->weight_h264_pixels_tab[9]= weight_h264_pixels2x2_c; nengel@2: c->biweight_h264_pixels_tab[0]= biweight_h264_pixels16x16_c; nengel@2: c->biweight_h264_pixels_tab[1]= biweight_h264_pixels16x8_c; nengel@2: c->biweight_h264_pixels_tab[2]= biweight_h264_pixels8x16_c; nengel@2: c->biweight_h264_pixels_tab[3]= biweight_h264_pixels8x8_c; nengel@2: c->biweight_h264_pixels_tab[4]= biweight_h264_pixels8x4_c; nengel@2: c->biweight_h264_pixels_tab[5]= biweight_h264_pixels4x8_c; nengel@2: c->biweight_h264_pixels_tab[6]= biweight_h264_pixels4x4_c; nengel@2: c->biweight_h264_pixels_tab[7]= biweight_h264_pixels4x2_c; nengel@2: c->biweight_h264_pixels_tab[8]= biweight_h264_pixels2x4_c; nengel@2: c->biweight_h264_pixels_tab[9]= biweight_h264_pixels2x2_c; nengel@2: nengel@2: nengel@2: #define dspfunc(PFX, IDX, NUM) \ nengel@2: c->PFX ## _pixels_tab[IDX][ 0] = PFX ## NUM ## _mc00_spu; \ nengel@2: c->PFX ## _pixels_tab[IDX][ 1] = PFX ## NUM ## _mc10_spu; \ nengel@2: c->PFX ## _pixels_tab[IDX][ 2] = PFX ## NUM ## _mc20_spu; \ nengel@2: c->PFX ## _pixels_tab[IDX][ 3] = PFX ## NUM ## _mc30_spu; \ nengel@2: c->PFX ## _pixels_tab[IDX][ 4] = PFX ## NUM ## _mc01_spu; \ nengel@2: c->PFX ## _pixels_tab[IDX][ 5] = PFX ## NUM ## _mc11_spu; \ nengel@2: c->PFX ## _pixels_tab[IDX][ 6] = PFX ## NUM ## _mc21_spu; \ nengel@2: c->PFX ## _pixels_tab[IDX][ 7] = PFX ## NUM ## _mc31_spu; \ nengel@2: c->PFX ## _pixels_tab[IDX][ 8] = PFX ## NUM ## _mc02_spu; \ nengel@2: c->PFX ## _pixels_tab[IDX][ 9] = PFX ## NUM ## _mc12_spu; \ nengel@2: c->PFX ## _pixels_tab[IDX][10] = PFX ## NUM ## _mc22_spu; \ nengel@2: c->PFX ## _pixels_tab[IDX][11] = PFX ## NUM ## _mc32_spu; \ nengel@2: c->PFX ## _pixels_tab[IDX][12] = PFX ## NUM ## _mc03_spu; \ nengel@2: c->PFX ## _pixels_tab[IDX][13] = PFX ## NUM ## _mc13_spu; \ nengel@2: c->PFX ## _pixels_tab[IDX][14] = PFX ## NUM ## _mc23_spu; \ nengel@2: c->PFX ## _pixels_tab[IDX][15] = PFX ## NUM ## _mc33_spu nengel@2: nengel@2: dspfunc(put_h264_qpel, 0, 16); nengel@2: dspfunc(put_h264_qpel, 1, 8); nengel@2: dspfunc(put_h264_qpel, 2, 4); nengel@2: nengel@2: dspfunc(avg_h264_qpel, 0, 16); nengel@2: dspfunc(avg_h264_qpel, 1, 8); nengel@2: dspfunc(avg_h264_qpel, 2, 4); nengel@2: nengel@2: #undef dspfunc nengel@2: nengel@2: nengel@2: }