Mercurial > libavcodec.hg
comparison h264.c @ 2509:b3b06ba8787c libavcodec
remove goto and reindent patch by (Loic Le Loarer <lll+ffmpeg m4x org>)
author | michael |
---|---|
date | Wed, 16 Feb 2005 23:18:06 +0000 |
parents | f12657081093 |
children | b34f2cac6a71 |
comparison
equal
deleted
inserted
replaced
2508:b0ec6f51b5bd | 2509:b3b06ba8787c |
---|---|
2763 for (x=0; x<4; x++) { | 2763 for (x=0; x<4; x++) { |
2764 *(dest_cr + h->block_offset[i] + y*uvlinesize + x) = h->mb[i*16+y*4+x]; | 2764 *(dest_cr + h->block_offset[i] + y*uvlinesize + x) = h->mb[i*16+y*4+x]; |
2765 } | 2765 } |
2766 } | 2766 } |
2767 } | 2767 } |
2768 goto deblock; | 2768 } else { |
2769 } | 2769 if(IS_INTRA(mb_type)){ |
2770 if(IS_INTRA(mb_type)){ | 2770 if(h->deblocking_filter) |
2771 if(h->deblocking_filter) | 2771 xchg_mb_border(h, dest_y, dest_cb, dest_cr, linesize, uvlinesize, 1); |
2772 xchg_mb_border(h, dest_y, dest_cb, dest_cr, linesize, uvlinesize, 1); | 2772 |
2773 if(!(s->flags&CODEC_FLAG_GRAY)){ | |
2774 h->pred8x8[ h->chroma_pred_mode ](dest_cb, uvlinesize); | |
2775 h->pred8x8[ h->chroma_pred_mode ](dest_cr, uvlinesize); | |
2776 } | |
2777 | |
2778 if(IS_INTRA4x4(mb_type)){ | |
2779 if(!s->encoding){ | |
2780 for(i=0; i<16; i++){ | |
2781 uint8_t * const ptr= dest_y + h->block_offset[i]; | |
2782 uint8_t *topright; | |
2783 const int dir= h->intra4x4_pred_mode_cache[ scan8[i] ]; | |
2784 int tr; | |
2785 | |
2786 if(dir == DIAG_DOWN_LEFT_PRED || dir == VERT_LEFT_PRED){ | |
2787 const int topright_avail= (h->topright_samples_available<<i)&0x8000; | |
2788 assert(mb_y || linesize <= h->block_offset[i]); | |
2789 if(!topright_avail){ | |
2790 tr= ptr[3 - linesize]*0x01010101; | |
2791 topright= (uint8_t*) &tr; | |
2792 }else if(i==5 && h->deblocking_filter){ | |
2793 tr= *(uint32_t*)h->top_border[mb_x+1]; | |
2794 topright= (uint8_t*) &tr; | |
2795 }else | |
2796 topright= ptr + 4 - linesize; | |
2797 }else | |
2798 topright= NULL; | |
2799 | |
2800 h->pred4x4[ dir ](ptr, topright, linesize); | |
2801 if(h->non_zero_count_cache[ scan8[i] ]){ | |
2802 if(s->codec_id == CODEC_ID_H264) | |
2803 s->dsp.h264_idct_add(ptr, h->mb + i*16, linesize); | |
2804 else | |
2805 svq3_add_idct_c(ptr, h->mb + i*16, linesize, s->qscale, 0); | |
2806 } | |
2807 } | |
2808 } | |
2809 }else{ | |
2810 h->pred16x16[ h->intra16x16_pred_mode ](dest_y , linesize); | |
2811 if(s->codec_id == CODEC_ID_H264) | |
2812 h264_luma_dc_dequant_idct_c(h->mb, s->qscale); | |
2813 else | |
2814 svq3_luma_dc_dequant_idct_c(h->mb, s->qscale); | |
2815 } | |
2816 if(h->deblocking_filter) | |
2817 xchg_mb_border(h, dest_y, dest_cb, dest_cr, linesize, uvlinesize, 0); | |
2818 }else if(s->codec_id == CODEC_ID_H264){ | |
2819 hl_motion(h, dest_y, dest_cb, dest_cr, | |
2820 s->dsp.put_h264_qpel_pixels_tab, s->dsp.put_h264_chroma_pixels_tab, | |
2821 s->dsp.avg_h264_qpel_pixels_tab, s->dsp.avg_h264_chroma_pixels_tab, | |
2822 s->dsp.weight_h264_pixels_tab, s->dsp.biweight_h264_pixels_tab); | |
2823 } | |
2824 | |
2825 | |
2826 if(!IS_INTRA4x4(mb_type)){ | |
2827 if(s->codec_id == CODEC_ID_H264){ | |
2828 for(i=0; i<16; i++){ | |
2829 if(h->non_zero_count_cache[ scan8[i] ] || h->mb[i*16]){ //FIXME benchmark weird rule, & below | |
2830 uint8_t * const ptr= dest_y + h->block_offset[i]; | |
2831 s->dsp.h264_idct_add(ptr, h->mb + i*16, linesize); | |
2832 } | |
2833 } | |
2834 }else{ | |
2835 for(i=0; i<16; i++){ | |
2836 if(h->non_zero_count_cache[ scan8[i] ] || h->mb[i*16]){ //FIXME benchmark weird rule, & below | |
2837 uint8_t * const ptr= dest_y + h->block_offset[i]; | |
2838 svq3_add_idct_c(ptr, h->mb + i*16, linesize, s->qscale, IS_INTRA(mb_type) ? 1 : 0); | |
2839 } | |
2840 } | |
2841 } | |
2842 } | |
2773 | 2843 |
2774 if(!(s->flags&CODEC_FLAG_GRAY)){ | 2844 if(!(s->flags&CODEC_FLAG_GRAY)){ |
2775 h->pred8x8[ h->chroma_pred_mode ](dest_cb, uvlinesize); | 2845 chroma_dc_dequant_idct_c(h->mb + 16*16, h->chroma_qp); |
2776 h->pred8x8[ h->chroma_pred_mode ](dest_cr, uvlinesize); | 2846 chroma_dc_dequant_idct_c(h->mb + 16*16+4*16, h->chroma_qp); |
2777 } | 2847 if(s->codec_id == CODEC_ID_H264){ |
2778 | 2848 for(i=16; i<16+4; i++){ |
2779 if(IS_INTRA4x4(mb_type)){ | 2849 if(h->non_zero_count_cache[ scan8[i] ] || h->mb[i*16]){ |
2780 if(!s->encoding){ | 2850 uint8_t * const ptr= dest_cb + h->block_offset[i]; |
2781 for(i=0; i<16; i++){ | 2851 s->dsp.h264_idct_add(ptr, h->mb + i*16, uvlinesize); |
2782 uint8_t * const ptr= dest_y + h->block_offset[i]; | |
2783 uint8_t *topright; | |
2784 const int dir= h->intra4x4_pred_mode_cache[ scan8[i] ]; | |
2785 int tr; | |
2786 | |
2787 if(dir == DIAG_DOWN_LEFT_PRED || dir == VERT_LEFT_PRED){ | |
2788 const int topright_avail= (h->topright_samples_available<<i)&0x8000; | |
2789 assert(mb_y || linesize <= h->block_offset[i]); | |
2790 if(!topright_avail){ | |
2791 tr= ptr[3 - linesize]*0x01010101; | |
2792 topright= (uint8_t*) &tr; | |
2793 }else if(i==5 && h->deblocking_filter){ | |
2794 tr= *(uint32_t*)h->top_border[mb_x+1]; | |
2795 topright= (uint8_t*) &tr; | |
2796 }else | |
2797 topright= ptr + 4 - linesize; | |
2798 }else | |
2799 topright= NULL; | |
2800 | |
2801 h->pred4x4[ dir ](ptr, topright, linesize); | |
2802 if(h->non_zero_count_cache[ scan8[i] ]){ | |
2803 if(s->codec_id == CODEC_ID_H264) | |
2804 s->dsp.h264_idct_add(ptr, h->mb + i*16, linesize); | |
2805 else | |
2806 svq3_add_idct_c(ptr, h->mb + i*16, linesize, s->qscale, 0); | |
2807 } | 2852 } |
2808 } | 2853 } |
2809 } | 2854 for(i=20; i<20+4; i++){ |
2810 }else{ | 2855 if(h->non_zero_count_cache[ scan8[i] ] || h->mb[i*16]){ |
2811 h->pred16x16[ h->intra16x16_pred_mode ](dest_y , linesize); | 2856 uint8_t * const ptr= dest_cr + h->block_offset[i]; |
2812 if(s->codec_id == CODEC_ID_H264) | 2857 s->dsp.h264_idct_add(ptr, h->mb + i*16, uvlinesize); |
2813 h264_luma_dc_dequant_idct_c(h->mb, s->qscale); | 2858 } |
2814 else | 2859 } |
2815 svq3_luma_dc_dequant_idct_c(h->mb, s->qscale); | 2860 }else{ |
2816 } | 2861 for(i=16; i<16+4; i++){ |
2817 if(h->deblocking_filter) | 2862 if(h->non_zero_count_cache[ scan8[i] ] || h->mb[i*16]){ |
2818 xchg_mb_border(h, dest_y, dest_cb, dest_cr, linesize, uvlinesize, 0); | 2863 uint8_t * const ptr= dest_cb + h->block_offset[i]; |
2819 }else if(s->codec_id == CODEC_ID_H264){ | 2864 svq3_add_idct_c(ptr, h->mb + i*16, uvlinesize, chroma_qp[s->qscale + 12] - 12, 2); |
2820 hl_motion(h, dest_y, dest_cb, dest_cr, | 2865 } |
2821 s->dsp.put_h264_qpel_pixels_tab, s->dsp.put_h264_chroma_pixels_tab, | 2866 } |
2822 s->dsp.avg_h264_qpel_pixels_tab, s->dsp.avg_h264_chroma_pixels_tab, | 2867 for(i=20; i<20+4; i++){ |
2823 s->dsp.weight_h264_pixels_tab, s->dsp.biweight_h264_pixels_tab); | 2868 if(h->non_zero_count_cache[ scan8[i] ] || h->mb[i*16]){ |
2824 } | 2869 uint8_t * const ptr= dest_cr + h->block_offset[i]; |
2825 | 2870 svq3_add_idct_c(ptr, h->mb + i*16, uvlinesize, chroma_qp[s->qscale + 12] - 12, 2); |
2826 | 2871 } |
2827 if(!IS_INTRA4x4(mb_type)){ | 2872 } |
2828 if(s->codec_id == CODEC_ID_H264){ | 2873 } |
2829 for(i=0; i<16; i++){ | 2874 } |
2830 if(h->non_zero_count_cache[ scan8[i] ] || h->mb[i*16]){ //FIXME benchmark weird rule, & below | 2875 } |
2831 uint8_t * const ptr= dest_y + h->block_offset[i]; | |
2832 s->dsp.h264_idct_add(ptr, h->mb + i*16, linesize); | |
2833 } | |
2834 } | |
2835 }else{ | |
2836 for(i=0; i<16; i++){ | |
2837 if(h->non_zero_count_cache[ scan8[i] ] || h->mb[i*16]){ //FIXME benchmark weird rule, & below | |
2838 uint8_t * const ptr= dest_y + h->block_offset[i]; | |
2839 svq3_add_idct_c(ptr, h->mb + i*16, linesize, s->qscale, IS_INTRA(mb_type) ? 1 : 0); | |
2840 } | |
2841 } | |
2842 } | |
2843 } | |
2844 | |
2845 if(!(s->flags&CODEC_FLAG_GRAY)){ | |
2846 chroma_dc_dequant_idct_c(h->mb + 16*16, h->chroma_qp); | |
2847 chroma_dc_dequant_idct_c(h->mb + 16*16+4*16, h->chroma_qp); | |
2848 if(s->codec_id == CODEC_ID_H264){ | |
2849 for(i=16; i<16+4; i++){ | |
2850 if(h->non_zero_count_cache[ scan8[i] ] || h->mb[i*16]){ | |
2851 uint8_t * const ptr= dest_cb + h->block_offset[i]; | |
2852 s->dsp.h264_idct_add(ptr, h->mb + i*16, uvlinesize); | |
2853 } | |
2854 } | |
2855 for(i=20; i<20+4; i++){ | |
2856 if(h->non_zero_count_cache[ scan8[i] ] || h->mb[i*16]){ | |
2857 uint8_t * const ptr= dest_cr + h->block_offset[i]; | |
2858 s->dsp.h264_idct_add(ptr, h->mb + i*16, uvlinesize); | |
2859 } | |
2860 } | |
2861 }else{ | |
2862 for(i=16; i<16+4; i++){ | |
2863 if(h->non_zero_count_cache[ scan8[i] ] || h->mb[i*16]){ | |
2864 uint8_t * const ptr= dest_cb + h->block_offset[i]; | |
2865 svq3_add_idct_c(ptr, h->mb + i*16, uvlinesize, chroma_qp[s->qscale + 12] - 12, 2); | |
2866 } | |
2867 } | |
2868 for(i=20; i<20+4; i++){ | |
2869 if(h->non_zero_count_cache[ scan8[i] ] || h->mb[i*16]){ | |
2870 uint8_t * const ptr= dest_cr + h->block_offset[i]; | |
2871 svq3_add_idct_c(ptr, h->mb + i*16, uvlinesize, chroma_qp[s->qscale + 12] - 12, 2); | |
2872 } | |
2873 } | |
2874 } | |
2875 } | |
2876 deblock: | |
2877 if(h->deblocking_filter) { | 2876 if(h->deblocking_filter) { |
2878 backup_mb_border(h, dest_y, dest_cb, dest_cr, linesize, uvlinesize); | 2877 backup_mb_border(h, dest_y, dest_cb, dest_cr, linesize, uvlinesize); |
2879 fill_caches(h, mb_type, 1); //FIXME dont fill stuff which isnt used by filter_mb | 2878 fill_caches(h, mb_type, 1); //FIXME dont fill stuff which isnt used by filter_mb |
2880 filter_mb(h, mb_x, mb_y, dest_y, dest_cb, dest_cr); | 2879 filter_mb(h, mb_x, mb_y, dest_y, dest_cb, dest_cr); |
2881 } | 2880 } |