Mercurial > libavcodec.hg
comparison dsputil.c @ 8395:195cba8f6257 libavcodec
Move filter_luma_intra into dsputil for later addition of asm.
author | darkshikari |
---|---|
date | Fri, 19 Dec 2008 00:44:51 +0000 |
parents | de2509cf3c44 |
children | b0ec9768b39b |
comparison
equal
deleted
inserted
replaced
8394:a9132c1bd56a | 8395:195cba8f6257 |
---|---|
2985 static void h264_h_loop_filter_luma_c(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0) | 2985 static void h264_h_loop_filter_luma_c(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0) |
2986 { | 2986 { |
2987 h264_loop_filter_luma_c(pix, 1, stride, alpha, beta, tc0); | 2987 h264_loop_filter_luma_c(pix, 1, stride, alpha, beta, tc0); |
2988 } | 2988 } |
2989 | 2989 |
2990 static inline void h264_loop_filter_luma_intra_c(uint8_t *pix, int xstride, int ystride, int alpha, int beta) | |
2991 { | |
2992 int d; | |
2993 for( d = 0; d < 16; d++ ) { | |
2994 const int p2 = pix[-3*xstride]; | |
2995 const int p1 = pix[-2*xstride]; | |
2996 const int p0 = pix[-1*xstride]; | |
2997 | |
2998 const int q0 = pix[ 0*xstride]; | |
2999 const int q1 = pix[ 1*xstride]; | |
3000 const int q2 = pix[ 2*xstride]; | |
3001 | |
3002 if( FFABS( p0 - q0 ) < alpha && | |
3003 FFABS( p1 - p0 ) < beta && | |
3004 FFABS( q1 - q0 ) < beta ) { | |
3005 | |
3006 if(FFABS( p0 - q0 ) < (( alpha >> 2 ) + 2 )){ | |
3007 if( FFABS( p2 - p0 ) < beta) | |
3008 { | |
3009 const int p3 = pix[-4*xstride]; | |
3010 /* p0', p1', p2' */ | |
3011 pix[-1*xstride] = ( p2 + 2*p1 + 2*p0 + 2*q0 + q1 + 4 ) >> 3; | |
3012 pix[-2*xstride] = ( p2 + p1 + p0 + q0 + 2 ) >> 2; | |
3013 pix[-3*xstride] = ( 2*p3 + 3*p2 + p1 + p0 + q0 + 4 ) >> 3; | |
3014 } else { | |
3015 /* p0' */ | |
3016 pix[-1*xstride] = ( 2*p1 + p0 + q1 + 2 ) >> 2; | |
3017 } | |
3018 if( FFABS( q2 - q0 ) < beta) | |
3019 { | |
3020 const int q3 = pix[3*xstride]; | |
3021 /* q0', q1', q2' */ | |
3022 pix[0*xstride] = ( p1 + 2*p0 + 2*q0 + 2*q1 + q2 + 4 ) >> 3; | |
3023 pix[1*xstride] = ( p0 + q0 + q1 + q2 + 2 ) >> 2; | |
3024 pix[2*xstride] = ( 2*q3 + 3*q2 + q1 + q0 + p0 + 4 ) >> 3; | |
3025 } else { | |
3026 /* q0' */ | |
3027 pix[0*xstride] = ( 2*q1 + q0 + p1 + 2 ) >> 2; | |
3028 } | |
3029 }else{ | |
3030 /* p0', q0' */ | |
3031 pix[-1*xstride] = ( 2*p1 + p0 + q1 + 2 ) >> 2; | |
3032 pix[ 0*xstride] = ( 2*q1 + q0 + p1 + 2 ) >> 2; | |
3033 } | |
3034 } | |
3035 pix += ystride; | |
3036 } | |
3037 } | |
3038 static void h264_v_loop_filter_luma_intra_c(uint8_t *pix, int stride, int alpha, int beta) | |
3039 { | |
3040 h264_loop_filter_luma_intra_c(pix, stride, 1, alpha, beta); | |
3041 } | |
3042 static void h264_h_loop_filter_luma_intra_c(uint8_t *pix, int stride, int alpha, int beta) | |
3043 { | |
3044 h264_loop_filter_luma_intra_c(pix, 1, stride, alpha, beta); | |
3045 } | |
3046 | |
2990 static inline void h264_loop_filter_chroma_c(uint8_t *pix, int xstride, int ystride, int alpha, int beta, int8_t *tc0) | 3047 static inline void h264_loop_filter_chroma_c(uint8_t *pix, int xstride, int ystride, int alpha, int beta, int8_t *tc0) |
2991 { | 3048 { |
2992 int i, d; | 3049 int i, d; |
2993 for( i = 0; i < 4; i++ ) { | 3050 for( i = 0; i < 4; i++ ) { |
2994 const int tc = tc0[i]; | 3051 const int tc = tc0[i]; |
4498 c->add_png_paeth_prediction= ff_add_png_paeth_prediction; | 4555 c->add_png_paeth_prediction= ff_add_png_paeth_prediction; |
4499 #endif | 4556 #endif |
4500 | 4557 |
4501 c->h264_v_loop_filter_luma= h264_v_loop_filter_luma_c; | 4558 c->h264_v_loop_filter_luma= h264_v_loop_filter_luma_c; |
4502 c->h264_h_loop_filter_luma= h264_h_loop_filter_luma_c; | 4559 c->h264_h_loop_filter_luma= h264_h_loop_filter_luma_c; |
4560 c->h264_v_loop_filter_luma_intra= h264_v_loop_filter_luma_intra_c; | |
4561 c->h264_h_loop_filter_luma_intra= h264_h_loop_filter_luma_intra_c; | |
4503 c->h264_v_loop_filter_chroma= h264_v_loop_filter_chroma_c; | 4562 c->h264_v_loop_filter_chroma= h264_v_loop_filter_chroma_c; |
4504 c->h264_h_loop_filter_chroma= h264_h_loop_filter_chroma_c; | 4563 c->h264_h_loop_filter_chroma= h264_h_loop_filter_chroma_c; |
4505 c->h264_v_loop_filter_chroma_intra= h264_v_loop_filter_chroma_intra_c; | 4564 c->h264_v_loop_filter_chroma_intra= h264_v_loop_filter_chroma_intra_c; |
4506 c->h264_h_loop_filter_chroma_intra= h264_h_loop_filter_chroma_intra_c; | 4565 c->h264_h_loop_filter_chroma_intra= h264_h_loop_filter_chroma_intra_c; |
4507 c->h264_loop_filter_strength= NULL; | 4566 c->h264_loop_filter_strength= NULL; |