Mercurial > libavcodec.hg
comparison h264.c @ 4546:211b40fb255b libavcodec
simplify in fill_caches
author | lorenm |
---|---|
date | Mon, 19 Feb 2007 04:44:17 +0000 |
parents | 1c8bc533da57 |
children | 1a714d3f0233 |
comparison
equal
deleted
inserted
replaced
4545:219255141aa1 | 4546:211b40fb255b |
---|---|
810 *(uint32_t*)h->mv_cache [list][scan8[0] + 2 - 1*8]= | 810 *(uint32_t*)h->mv_cache [list][scan8[0] + 2 - 1*8]= |
811 *(uint32_t*)h->mv_cache [list][scan8[0] + 3 - 1*8]= 0; | 811 *(uint32_t*)h->mv_cache [list][scan8[0] + 3 - 1*8]= 0; |
812 *(uint32_t*)&h->ref_cache[list][scan8[0] + 0 - 1*8]= ((top_type ? LIST_NOT_USED : PART_NOT_AVAILABLE)&0xFF)*0x01010101; | 812 *(uint32_t*)&h->ref_cache[list][scan8[0] + 0 - 1*8]= ((top_type ? LIST_NOT_USED : PART_NOT_AVAILABLE)&0xFF)*0x01010101; |
813 } | 813 } |
814 | 814 |
815 //FIXME unify cleanup or sth | 815 for(i=0; i<2; i++){ |
816 if(USES_LIST(left_type[0], list)){ | 816 int cache_idx = scan8[0] - 1 + i*2*8; |
817 const int b_xy= h->mb2b_xy[left_xy[0]] + 3; | 817 if(USES_LIST(left_type[i], list)){ |
818 const int b8_xy= h->mb2b8_xy[left_xy[0]] + 1; | 818 const int b_xy= h->mb2b_xy[left_xy[i]] + 3; |
819 *(uint32_t*)h->mv_cache[list][scan8[0] - 1 + 0*8]= *(uint32_t*)s->current_picture.motion_val[list][b_xy + h->b_stride*left_block[0]]; | 819 const int b8_xy= h->mb2b8_xy[left_xy[i]] + 1; |
820 *(uint32_t*)h->mv_cache[list][scan8[0] - 1 + 1*8]= *(uint32_t*)s->current_picture.motion_val[list][b_xy + h->b_stride*left_block[1]]; | 820 *(uint32_t*)h->mv_cache[list][cache_idx ]= *(uint32_t*)s->current_picture.motion_val[list][b_xy + h->b_stride*left_block[0+i*2]]; |
821 h->ref_cache[list][scan8[0] - 1 + 0*8]= s->current_picture.ref_index[list][b8_xy + h->b8_stride*(left_block[0]>>1)]; | 821 *(uint32_t*)h->mv_cache[list][cache_idx+8]= *(uint32_t*)s->current_picture.motion_val[list][b_xy + h->b_stride*left_block[1+i*2]]; |
822 h->ref_cache[list][scan8[0] - 1 + 1*8]= s->current_picture.ref_index[list][b8_xy + h->b8_stride*(left_block[1]>>1)]; | 822 h->ref_cache[list][cache_idx ]= s->current_picture.ref_index[list][b8_xy + h->b8_stride*(left_block[0+i*2]>>1)]; |
823 }else{ | 823 h->ref_cache[list][cache_idx+8]= s->current_picture.ref_index[list][b8_xy + h->b8_stride*(left_block[1+i*2]>>1)]; |
824 *(uint32_t*)h->mv_cache [list][scan8[0] - 1 + 0*8]= | 824 }else{ |
825 *(uint32_t*)h->mv_cache [list][scan8[0] - 1 + 1*8]= 0; | 825 *(uint32_t*)h->mv_cache [list][cache_idx ]= |
826 h->ref_cache[list][scan8[0] - 1 + 0*8]= | 826 *(uint32_t*)h->mv_cache [list][cache_idx+8]= 0; |
827 h->ref_cache[list][scan8[0] - 1 + 1*8]= left_type[0] ? LIST_NOT_USED : PART_NOT_AVAILABLE; | 827 h->ref_cache[list][cache_idx ]= |
828 } | 828 h->ref_cache[list][cache_idx+8]= left_type[i] ? LIST_NOT_USED : PART_NOT_AVAILABLE; |
829 | 829 } |
830 if(USES_LIST(left_type[1], list)){ | |
831 const int b_xy= h->mb2b_xy[left_xy[1]] + 3; | |
832 const int b8_xy= h->mb2b8_xy[left_xy[1]] + 1; | |
833 *(uint32_t*)h->mv_cache[list][scan8[0] - 1 + 2*8]= *(uint32_t*)s->current_picture.motion_val[list][b_xy + h->b_stride*left_block[2]]; | |
834 *(uint32_t*)h->mv_cache[list][scan8[0] - 1 + 3*8]= *(uint32_t*)s->current_picture.motion_val[list][b_xy + h->b_stride*left_block[3]]; | |
835 h->ref_cache[list][scan8[0] - 1 + 2*8]= s->current_picture.ref_index[list][b8_xy + h->b8_stride*(left_block[2]>>1)]; | |
836 h->ref_cache[list][scan8[0] - 1 + 3*8]= s->current_picture.ref_index[list][b8_xy + h->b8_stride*(left_block[3]>>1)]; | |
837 }else{ | |
838 *(uint32_t*)h->mv_cache [list][scan8[0] - 1 + 2*8]= | |
839 *(uint32_t*)h->mv_cache [list][scan8[0] - 1 + 3*8]= 0; | |
840 h->ref_cache[list][scan8[0] - 1 + 2*8]= | |
841 h->ref_cache[list][scan8[0] - 1 + 3*8]= left_type[0] ? LIST_NOT_USED : PART_NOT_AVAILABLE; | |
842 assert((!left_type[0]) == (!left_type[1])); | |
843 } | 830 } |
844 | 831 |
845 if((for_deblock || (IS_DIRECT(mb_type) && !h->direct_spatial_mv_pred)) && !FRAME_MBAFF) | 832 if((for_deblock || (IS_DIRECT(mb_type) && !h->direct_spatial_mv_pred)) && !FRAME_MBAFF) |
846 continue; | 833 continue; |
847 | 834 |
3630 for(i=0; i<16; i+=4){ | 3617 for(i=0; i<16; i+=4){ |
3631 uint8_t * const ptr= dest_y + block_offset[i]; | 3618 uint8_t * const ptr= dest_y + block_offset[i]; |
3632 const int dir= h->intra4x4_pred_mode_cache[ scan8[i] ]; | 3619 const int dir= h->intra4x4_pred_mode_cache[ scan8[i] ]; |
3633 const int nnz = h->non_zero_count_cache[ scan8[i] ]; | 3620 const int nnz = h->non_zero_count_cache[ scan8[i] ]; |
3634 h->pred8x8l[ dir ](ptr, (h->topleft_samples_available<<i)&0x8000, | 3621 h->pred8x8l[ dir ](ptr, (h->topleft_samples_available<<i)&0x8000, |
3635 (h->topright_samples_available<<(i+1))&0x8000, linesize); | 3622 (h->topright_samples_available<<i)&0x4000, linesize); |
3636 if(nnz){ | 3623 if(nnz){ |
3637 if(nnz == 1 && h->mb[i*16]) | 3624 if(nnz == 1 && h->mb[i*16]) |
3638 idct_dc_add(ptr, h->mb + i*16, linesize); | 3625 idct_dc_add(ptr, h->mb + i*16, linesize); |
3639 else | 3626 else |
3640 idct_add(ptr, h->mb + i*16, linesize); | 3627 idct_add(ptr, h->mb + i*16, linesize); |