Mercurial > libavcodec.hg
comparison snow.c @ 4283:d6f83e2f8804 libavcodec
rename always_inline to av_always_inline and move to common.h
author | mru |
---|---|
date | Fri, 08 Dec 2006 00:35:08 +0000 |
parents | bbe0bc387a19 |
children | e571dfe677be |
comparison
equal
deleted
inserted
replaced
4282:9d64f6eacc7b | 4283:d6f83e2f8804 |
---|---|
707 } | 707 } |
708 | 708 |
709 return v; | 709 return v; |
710 } | 710 } |
711 | 711 |
712 static always_inline void lift(DWTELEM *dst, DWTELEM *src, DWTELEM *ref, int dst_step, int src_step, int ref_step, int width, int mul, int add, int shift, int highpass, int inverse){ | 712 static av_always_inline void lift(DWTELEM *dst, DWTELEM *src, DWTELEM *ref, int dst_step, int src_step, int ref_step, int width, int mul, int add, int shift, int highpass, int inverse){ |
713 const int mirror_left= !highpass; | 713 const int mirror_left= !highpass; |
714 const int mirror_right= (width&1) ^ highpass; | 714 const int mirror_right= (width&1) ^ highpass; |
715 const int w= (width>>1) - 1 + (highpass & width); | 715 const int w= (width>>1) - 1 + (highpass & width); |
716 int i; | 716 int i; |
717 | 717 |
730 dst[w*dst_step] = LIFT(src[w*src_step], ((mul*2*ref[w*ref_step]+add)>>shift), inverse); | 730 dst[w*dst_step] = LIFT(src[w*src_step], ((mul*2*ref[w*ref_step]+add)>>shift), inverse); |
731 } | 731 } |
732 } | 732 } |
733 | 733 |
734 #ifndef lift5 | 734 #ifndef lift5 |
735 static always_inline void lift5(DWTELEM *dst, DWTELEM *src, DWTELEM *ref, int dst_step, int src_step, int ref_step, int width, int mul, int add, int shift, int highpass, int inverse){ | 735 static av_always_inline void lift5(DWTELEM *dst, DWTELEM *src, DWTELEM *ref, int dst_step, int src_step, int ref_step, int width, int mul, int add, int shift, int highpass, int inverse){ |
736 const int mirror_left= !highpass; | 736 const int mirror_left= !highpass; |
737 const int mirror_right= (width&1) ^ highpass; | 737 const int mirror_right= (width&1) ^ highpass; |
738 const int w= (width>>1) - 1 + (highpass & width); | 738 const int w= (width>>1) - 1 + (highpass & width); |
739 int i; | 739 int i; |
740 | 740 |
762 } | 762 } |
763 } | 763 } |
764 #endif | 764 #endif |
765 | 765 |
766 #ifndef liftS | 766 #ifndef liftS |
767 static always_inline void liftS(DWTELEM *dst, DWTELEM *src, DWTELEM *ref, int dst_step, int src_step, int ref_step, int width, int mul, int add, int shift, int highpass, int inverse){ | 767 static av_always_inline void liftS(DWTELEM *dst, DWTELEM *src, DWTELEM *ref, int dst_step, int src_step, int ref_step, int width, int mul, int add, int shift, int highpass, int inverse){ |
768 const int mirror_left= !highpass; | 768 const int mirror_left= !highpass; |
769 const int mirror_right= (width&1) ^ highpass; | 769 const int mirror_right= (width&1) ^ highpass; |
770 const int w= (width>>1) - 1 + (highpass & width); | 770 const int w= (width>>1) - 1 + (highpass & width); |
771 int i; | 771 int i; |
772 | 772 |
2204 memcpy(s->block_state, p_state, sizeof(s->block_state)); | 2204 memcpy(s->block_state, p_state, sizeof(s->block_state)); |
2205 return score; | 2205 return score; |
2206 } | 2206 } |
2207 } | 2207 } |
2208 | 2208 |
2209 static always_inline int same_block(BlockNode *a, BlockNode *b){ | 2209 static av_always_inline int same_block(BlockNode *a, BlockNode *b){ |
2210 if((a->type&BLOCK_INTRA) && (b->type&BLOCK_INTRA)){ | 2210 if((a->type&BLOCK_INTRA) && (b->type&BLOCK_INTRA)){ |
2211 return !((a->color[0] - b->color[0]) | (a->color[1] - b->color[1]) | (a->color[2] - b->color[2])); | 2211 return !((a->color[0] - b->color[0]) | (a->color[1] - b->color[1]) | (a->color[2] - b->color[2])); |
2212 }else{ | 2212 }else{ |
2213 return !((a->mx - b->mx) | (a->my - b->my) | (a->ref - b->ref) | ((a->type ^ b->type)&BLOCK_INTRA)); | 2213 return !((a->mx - b->mx) | (a->my - b->my) | (a->ref - b->ref) | ((a->type ^ b->type)&BLOCK_INTRA)); |
2214 } | 2214 } |
2551 } | 2551 } |
2552 } | 2552 } |
2553 } | 2553 } |
2554 | 2554 |
2555 //FIXME name clenup (b_w, block_w, b_width stuff) | 2555 //FIXME name clenup (b_w, block_w, b_width stuff) |
2556 static always_inline void add_yblock(SnowContext *s, int sliced, slice_buffer *sb, DWTELEM *dst, uint8_t *dst8, const uint8_t *obmc, int src_x, int src_y, int b_w, int b_h, int w, int h, int dst_stride, int src_stride, int obmc_stride, int b_x, int b_y, int add, int offset_dst, int plane_index){ | 2556 static av_always_inline void add_yblock(SnowContext *s, int sliced, slice_buffer *sb, DWTELEM *dst, uint8_t *dst8, const uint8_t *obmc, int src_x, int src_y, int b_w, int b_h, int w, int h, int dst_stride, int src_stride, int obmc_stride, int b_x, int b_y, int add, int offset_dst, int plane_index){ |
2557 const int b_width = s->b_width << s->block_max_depth; | 2557 const int b_width = s->b_width << s->block_max_depth; |
2558 const int b_height= s->b_height << s->block_max_depth; | 2558 const int b_height= s->b_height << s->block_max_depth; |
2559 const int b_stride= b_width; | 2559 const int b_stride= b_width; |
2560 BlockNode *lt= &s->block[b_x + b_y*b_stride]; | 2560 BlockNode *lt= &s->block[b_x + b_y*b_stride]; |
2561 BlockNode *rt= lt+1; | 2561 BlockNode *rt= lt+1; |
2710 } | 2710 } |
2711 } | 2711 } |
2712 #endif | 2712 #endif |
2713 } | 2713 } |
2714 | 2714 |
2715 static always_inline void predict_slice_buffered(SnowContext *s, slice_buffer * sb, DWTELEM * old_buffer, int plane_index, int add, int mb_y){ | 2715 static av_always_inline void predict_slice_buffered(SnowContext *s, slice_buffer * sb, DWTELEM * old_buffer, int plane_index, int add, int mb_y){ |
2716 Plane *p= &s->plane[plane_index]; | 2716 Plane *p= &s->plane[plane_index]; |
2717 const int mb_w= s->b_width << s->block_max_depth; | 2717 const int mb_w= s->b_width << s->block_max_depth; |
2718 const int mb_h= s->b_height << s->block_max_depth; | 2718 const int mb_h= s->b_height << s->block_max_depth; |
2719 int x, y, mb_x; | 2719 int x, y, mb_x; |
2720 int block_size = MB_SIZE >> s->block_max_depth; | 2720 int block_size = MB_SIZE >> s->block_max_depth; |
2777 } | 2777 } |
2778 | 2778 |
2779 STOP_TIMER("predict_slice") | 2779 STOP_TIMER("predict_slice") |
2780 } | 2780 } |
2781 | 2781 |
2782 static always_inline void predict_slice(SnowContext *s, DWTELEM *buf, int plane_index, int add, int mb_y){ | 2782 static av_always_inline void predict_slice(SnowContext *s, DWTELEM *buf, int plane_index, int add, int mb_y){ |
2783 Plane *p= &s->plane[plane_index]; | 2783 Plane *p= &s->plane[plane_index]; |
2784 const int mb_w= s->b_width << s->block_max_depth; | 2784 const int mb_w= s->b_width << s->block_max_depth; |
2785 const int mb_h= s->b_height << s->block_max_depth; | 2785 const int mb_h= s->b_height << s->block_max_depth; |
2786 int x, y, mb_x; | 2786 int x, y, mb_x; |
2787 int block_size = MB_SIZE >> s->block_max_depth; | 2787 int block_size = MB_SIZE >> s->block_max_depth; |
2834 } | 2834 } |
2835 | 2835 |
2836 STOP_TIMER("predict_slice") | 2836 STOP_TIMER("predict_slice") |
2837 } | 2837 } |
2838 | 2838 |
2839 static always_inline void predict_plane(SnowContext *s, DWTELEM *buf, int plane_index, int add){ | 2839 static av_always_inline void predict_plane(SnowContext *s, DWTELEM *buf, int plane_index, int add){ |
2840 const int mb_h= s->b_height << s->block_max_depth; | 2840 const int mb_h= s->b_height << s->block_max_depth; |
2841 int mb_y; | 2841 int mb_y; |
2842 for(mb_y=0; mb_y<=mb_h; mb_y++) | 2842 for(mb_y=0; mb_y<=mb_h; mb_y++) |
2843 predict_slice(s, buf, plane_index, add, mb_y); | 2843 predict_slice(s, buf, plane_index, add, mb_y); |
2844 } | 2844 } |
3092 } | 3092 } |
3093 } | 3093 } |
3094 return distortion + rate*penalty_factor; | 3094 return distortion + rate*penalty_factor; |
3095 } | 3095 } |
3096 | 3096 |
3097 static always_inline int check_block(SnowContext *s, int mb_x, int mb_y, int p[3], int intra, const uint8_t *obmc_edged, int *best_rd){ | 3097 static av_always_inline int check_block(SnowContext *s, int mb_x, int mb_y, int p[3], int intra, const uint8_t *obmc_edged, int *best_rd){ |
3098 const int b_stride= s->b_width << s->block_max_depth; | 3098 const int b_stride= s->b_width << s->block_max_depth; |
3099 BlockNode *block= &s->block[mb_x + mb_y * b_stride]; | 3099 BlockNode *block= &s->block[mb_x + mb_y * b_stride]; |
3100 BlockNode backup= *block; | 3100 BlockNode backup= *block; |
3101 int rd, index, value; | 3101 int rd, index, value; |
3102 | 3102 |
3131 return 0; | 3131 return 0; |
3132 } | 3132 } |
3133 } | 3133 } |
3134 | 3134 |
3135 /* special case for int[2] args we discard afterward, fixes compilation prob with gcc 2.95 */ | 3135 /* special case for int[2] args we discard afterward, fixes compilation prob with gcc 2.95 */ |
3136 static always_inline int check_block_inter(SnowContext *s, int mb_x, int mb_y, int p0, int p1, const uint8_t *obmc_edged, int *best_rd){ | 3136 static av_always_inline int check_block_inter(SnowContext *s, int mb_x, int mb_y, int p0, int p1, const uint8_t *obmc_edged, int *best_rd){ |
3137 int p[2] = {p0, p1}; | 3137 int p[2] = {p0, p1}; |
3138 return check_block(s, mb_x, mb_y, p, 0, obmc_edged, best_rd); | 3138 return check_block(s, mb_x, mb_y, p, 0, obmc_edged, best_rd); |
3139 } | 3139 } |
3140 | 3140 |
3141 static always_inline int check_4block_inter(SnowContext *s, int mb_x, int mb_y, int p0, int p1, int ref, int *best_rd){ | 3141 static av_always_inline int check_4block_inter(SnowContext *s, int mb_x, int mb_y, int p0, int p1, int ref, int *best_rd){ |
3142 const int b_stride= s->b_width << s->block_max_depth; | 3142 const int b_stride= s->b_width << s->block_max_depth; |
3143 BlockNode *block= &s->block[mb_x + mb_y * b_stride]; | 3143 BlockNode *block= &s->block[mb_x + mb_y * b_stride]; |
3144 BlockNode backup[4]= {block[0], block[1], block[b_stride], block[b_stride+1]}; | 3144 BlockNode backup[4]= {block[0], block[1], block[b_stride], block[b_stride+1]}; |
3145 int rd, index, value; | 3145 int rd, index, value; |
3146 | 3146 |