Mercurial > libavcodec.hg
comparison h264.h @ 10928:03d778b06643 libavcodec
Fix accumulated indention errors.
author | michael |
---|---|
date | Mon, 18 Jan 2010 23:34:37 +0000 |
parents | bb774f0bc2b6 |
children | 9b31065f013d |
comparison
equal
deleted
inserted
replaced
10927:bb774f0bc2b6 | 10928:03d778b06643 |
---|---|
796 h->left_mb_xy[1] = left_xy[1]; | 796 h->left_mb_xy[1] = left_xy[1]; |
797 if(for_deblock){ | 797 if(for_deblock){ |
798 | 798 |
799 //for sufficiently low qp, filtering wouldn't do anything | 799 //for sufficiently low qp, filtering wouldn't do anything |
800 //this is a conservative estimate: could also check beta_offset and more accurate chroma_qp | 800 //this is a conservative estimate: could also check beta_offset and more accurate chroma_qp |
801 int qp_thresh = h->qp_thresh; //FIXME strictly we should store qp_thresh for each mb of a slice | 801 int qp_thresh = h->qp_thresh; //FIXME strictly we should store qp_thresh for each mb of a slice |
802 int qp = s->current_picture.qscale_table[mb_xy]; | 802 int qp = s->current_picture.qscale_table[mb_xy]; |
803 if(qp <= qp_thresh | 803 if(qp <= qp_thresh |
804 && (left_xy[0]<0 || ((qp + s->current_picture.qscale_table[left_xy[0]] + 1)>>1) <= qp_thresh) | 804 && (left_xy[0]<0 || ((qp + s->current_picture.qscale_table[left_xy[0]] + 1)>>1) <= qp_thresh) |
805 && (left_xy[1]<0 || ((qp + s->current_picture.qscale_table[left_xy[1]] + 1)>>1) <= qp_thresh) | 805 && (left_xy[1]<0 || ((qp + s->current_picture.qscale_table[left_xy[1]] + 1)>>1) <= qp_thresh) |
806 && (top_xy < 0 || ((qp + s->current_picture.qscale_table[top_xy ] + 1)>>1) <= qp_thresh)){ | 806 && (top_xy < 0 || ((qp + s->current_picture.qscale_table[top_xy ] + 1)>>1) <= qp_thresh)){ |
807 return 1; | 807 return 1; |
808 } | 808 } |
809 | 809 |
810 *((uint64_t*)&h->non_zero_count_cache[0+8*1])= *((uint64_t*)&h->non_zero_count[mb_xy][ 0]); | 810 *((uint64_t*)&h->non_zero_count_cache[0+8*1])= *((uint64_t*)&h->non_zero_count[mb_xy][ 0]); |
811 *((uint64_t*)&h->non_zero_count_cache[0+8*2])= *((uint64_t*)&h->non_zero_count[mb_xy][ 8]); | 811 *((uint64_t*)&h->non_zero_count_cache[0+8*2])= *((uint64_t*)&h->non_zero_count[mb_xy][ 8]); |
812 *((uint32_t*)&h->non_zero_count_cache[0+8*5])= *((uint32_t*)&h->non_zero_count[mb_xy][16]); | 812 *((uint32_t*)&h->non_zero_count_cache[0+8*5])= *((uint32_t*)&h->non_zero_count[mb_xy][16]); |
813 *((uint32_t*)&h->non_zero_count_cache[4+8*3])= *((uint32_t*)&h->non_zero_count[mb_xy][20]); | 813 *((uint32_t*)&h->non_zero_count_cache[4+8*3])= *((uint32_t*)&h->non_zero_count[mb_xy][20]); |
864 top_type = h->slice_table[top_xy ] == h->slice_num ? s->current_picture.mb_type[top_xy] : 0; | 864 top_type = h->slice_table[top_xy ] == h->slice_num ? s->current_picture.mb_type[top_xy] : 0; |
865 topright_type= h->slice_table[topright_xy] == h->slice_num ? s->current_picture.mb_type[topright_xy]: 0; | 865 topright_type= h->slice_table[topright_xy] == h->slice_num ? s->current_picture.mb_type[topright_xy]: 0; |
866 left_type[0] = h->slice_table[left_xy[0] ] == h->slice_num ? s->current_picture.mb_type[left_xy[0]] : 0; | 866 left_type[0] = h->slice_table[left_xy[0] ] == h->slice_num ? s->current_picture.mb_type[left_xy[0]] : 0; |
867 left_type[1] = h->slice_table[left_xy[1] ] == h->slice_num ? s->current_picture.mb_type[left_xy[1]] : 0; | 867 left_type[1] = h->slice_table[left_xy[1] ] == h->slice_num ? s->current_picture.mb_type[left_xy[1]] : 0; |
868 | 868 |
869 if(IS_INTRA(mb_type)){ | 869 if(IS_INTRA(mb_type)){ |
870 int type_mask= h->pps.constrained_intra_pred ? IS_INTRA(-1) : -1; | 870 int type_mask= h->pps.constrained_intra_pred ? IS_INTRA(-1) : -1; |
871 h->topleft_samples_available= | 871 h->topleft_samples_available= |
872 h->top_samples_available= | 872 h->top_samples_available= |
873 h->left_samples_available= 0xFFFF; | 873 h->left_samples_available= 0xFFFF; |
874 h->topright_samples_available= 0xEEEA; | 874 h->topright_samples_available= 0xEEEA; |
875 | 875 |
876 if(!(top_type & type_mask)){ | 876 if(!(top_type & type_mask)){ |
877 h->topleft_samples_available= 0xB3FF; | 877 h->topleft_samples_available= 0xB3FF; |
878 h->top_samples_available= 0x33FF; | 878 h->top_samples_available= 0x33FF; |
879 h->topright_samples_available= 0x26EA; | 879 h->topright_samples_available= 0x26EA; |
880 } | 880 } |
881 if(IS_INTERLACED(mb_type) != IS_INTERLACED(left_type[0])){ | 881 if(IS_INTERLACED(mb_type) != IS_INTERLACED(left_type[0])){ |
882 if(IS_INTERLACED(mb_type)){ | 882 if(IS_INTERLACED(mb_type)){ |
883 if(!(left_type[0] & type_mask)){ | 883 if(!(left_type[0] & type_mask)){ |
884 h->topleft_samples_available&= 0xDFFF; | 884 h->topleft_samples_available&= 0xDFFF; |
885 h->left_samples_available&= 0x5FFF; | 885 h->left_samples_available&= 0x5FFF; |
886 } | 886 } |
887 if(!(left_type[1] & type_mask)){ | 887 if(!(left_type[1] & type_mask)){ |
888 h->topleft_samples_available&= 0xFF5F; | 888 h->topleft_samples_available&= 0xFF5F; |
889 h->left_samples_available&= 0xFF5F; | 889 h->left_samples_available&= 0xFF5F; |
890 } | |
891 }else{ | |
892 int left_typei = h->slice_table[left_xy[0] + s->mb_stride ] == h->slice_num | |
893 ? s->current_picture.mb_type[left_xy[0] + s->mb_stride] : 0; | |
894 assert(left_xy[0] == left_xy[1]); | |
895 if(!((left_typei & type_mask) && (left_type[0] & type_mask))){ | |
896 h->topleft_samples_available&= 0xDF5F; | |
897 h->left_samples_available&= 0x5F5F; | |
898 } | |
890 } | 899 } |
891 }else{ | 900 }else{ |
892 int left_typei = h->slice_table[left_xy[0] + s->mb_stride ] == h->slice_num | 901 if(!(left_type[0] & type_mask)){ |
893 ? s->current_picture.mb_type[left_xy[0] + s->mb_stride] : 0; | |
894 assert(left_xy[0] == left_xy[1]); | |
895 if(!((left_typei & type_mask) && (left_type[0] & type_mask))){ | |
896 h->topleft_samples_available&= 0xDF5F; | 902 h->topleft_samples_available&= 0xDF5F; |
897 h->left_samples_available&= 0x5F5F; | 903 h->left_samples_available&= 0x5F5F; |
898 } | 904 } |
899 } | 905 } |
900 }else{ | 906 |
901 if(!(left_type[0] & type_mask)){ | 907 if(!(topleft_type & type_mask)) |
902 h->topleft_samples_available&= 0xDF5F; | 908 h->topleft_samples_available&= 0x7FFF; |
903 h->left_samples_available&= 0x5F5F; | 909 |
904 } | 910 if(!(topright_type & type_mask)) |
905 } | 911 h->topright_samples_available&= 0xFBFF; |
906 | 912 |
907 if(!(topleft_type & type_mask)) | 913 if(IS_INTRA4x4(mb_type)){ |
908 h->topleft_samples_available&= 0x7FFF; | 914 if(IS_INTRA4x4(top_type)){ |
909 | 915 h->intra4x4_pred_mode_cache[4+8*0]= h->intra4x4_pred_mode[top_xy][4]; |
910 if(!(topright_type & type_mask)) | 916 h->intra4x4_pred_mode_cache[5+8*0]= h->intra4x4_pred_mode[top_xy][5]; |
911 h->topright_samples_available&= 0xFBFF; | 917 h->intra4x4_pred_mode_cache[6+8*0]= h->intra4x4_pred_mode[top_xy][6]; |
912 | 918 h->intra4x4_pred_mode_cache[7+8*0]= h->intra4x4_pred_mode[top_xy][3]; |
913 if(IS_INTRA4x4(mb_type)){ | |
914 if(IS_INTRA4x4(top_type)){ | |
915 h->intra4x4_pred_mode_cache[4+8*0]= h->intra4x4_pred_mode[top_xy][4]; | |
916 h->intra4x4_pred_mode_cache[5+8*0]= h->intra4x4_pred_mode[top_xy][5]; | |
917 h->intra4x4_pred_mode_cache[6+8*0]= h->intra4x4_pred_mode[top_xy][6]; | |
918 h->intra4x4_pred_mode_cache[7+8*0]= h->intra4x4_pred_mode[top_xy][3]; | |
919 }else{ | |
920 int pred; | |
921 if(!(top_type & type_mask)) | |
922 pred= -1; | |
923 else{ | |
924 pred= 2; | |
925 } | |
926 h->intra4x4_pred_mode_cache[4+8*0]= | |
927 h->intra4x4_pred_mode_cache[5+8*0]= | |
928 h->intra4x4_pred_mode_cache[6+8*0]= | |
929 h->intra4x4_pred_mode_cache[7+8*0]= pred; | |
930 } | |
931 for(i=0; i<2; i++){ | |
932 if(IS_INTRA4x4(left_type[i])){ | |
933 h->intra4x4_pred_mode_cache[3+8*1 + 2*8*i]= h->intra4x4_pred_mode[left_xy[i]][left_block[0+2*i]]; | |
934 h->intra4x4_pred_mode_cache[3+8*2 + 2*8*i]= h->intra4x4_pred_mode[left_xy[i]][left_block[1+2*i]]; | |
935 }else{ | 919 }else{ |
936 int pred; | 920 int pred; |
937 if(!(left_type[i] & type_mask)) | 921 if(!(top_type & type_mask)) |
938 pred= -1; | 922 pred= -1; |
939 else{ | 923 else{ |
940 pred= 2; | 924 pred= 2; |
941 } | 925 } |
942 h->intra4x4_pred_mode_cache[3+8*1 + 2*8*i]= | 926 h->intra4x4_pred_mode_cache[4+8*0]= |
943 h->intra4x4_pred_mode_cache[3+8*2 + 2*8*i]= pred; | 927 h->intra4x4_pred_mode_cache[5+8*0]= |
928 h->intra4x4_pred_mode_cache[6+8*0]= | |
929 h->intra4x4_pred_mode_cache[7+8*0]= pred; | |
930 } | |
931 for(i=0; i<2; i++){ | |
932 if(IS_INTRA4x4(left_type[i])){ | |
933 h->intra4x4_pred_mode_cache[3+8*1 + 2*8*i]= h->intra4x4_pred_mode[left_xy[i]][left_block[0+2*i]]; | |
934 h->intra4x4_pred_mode_cache[3+8*2 + 2*8*i]= h->intra4x4_pred_mode[left_xy[i]][left_block[1+2*i]]; | |
935 }else{ | |
936 int pred; | |
937 if(!(left_type[i] & type_mask)) | |
938 pred= -1; | |
939 else{ | |
940 pred= 2; | |
941 } | |
942 h->intra4x4_pred_mode_cache[3+8*1 + 2*8*i]= | |
943 h->intra4x4_pred_mode_cache[3+8*2 + 2*8*i]= pred; | |
944 } | |
944 } | 945 } |
945 } | 946 } |
946 } | 947 } |
947 } | |
948 } | 948 } |
949 | 949 |
950 | 950 |
951 /* | 951 /* |
952 0 . T T. T T T T | 952 0 . T T. T T T T |
958 */ | 958 */ |
959 //FIXME constraint_intra_pred & partitioning & nnz (let us hope this is just a typo in the spec) | 959 //FIXME constraint_intra_pred & partitioning & nnz (let us hope this is just a typo in the spec) |
960 if(top_type){ | 960 if(top_type){ |
961 *(uint32_t*)&h->non_zero_count_cache[4+8*0]= *(uint32_t*)&h->non_zero_count[top_xy][4+3*8]; | 961 *(uint32_t*)&h->non_zero_count_cache[4+8*0]= *(uint32_t*)&h->non_zero_count[top_xy][4+3*8]; |
962 if(!for_deblock){ | 962 if(!for_deblock){ |
963 h->non_zero_count_cache[1+8*0]= h->non_zero_count[top_xy][1+1*8]; | 963 h->non_zero_count_cache[1+8*0]= h->non_zero_count[top_xy][1+1*8]; |
964 h->non_zero_count_cache[2+8*0]= h->non_zero_count[top_xy][2+1*8]; | 964 h->non_zero_count_cache[2+8*0]= h->non_zero_count[top_xy][2+1*8]; |
965 | 965 |
966 h->non_zero_count_cache[1+8*3]= h->non_zero_count[top_xy][1+2*8]; | 966 h->non_zero_count_cache[1+8*3]= h->non_zero_count[top_xy][1+2*8]; |
967 h->non_zero_count_cache[2+8*3]= h->non_zero_count[top_xy][2+2*8]; | 967 h->non_zero_count_cache[2+8*3]= h->non_zero_count[top_xy][2+2*8]; |
968 } | 968 } |
969 }else{ | 969 }else{ |
970 if(for_deblock){ | 970 if(for_deblock){ |
971 *(uint32_t*)&h->non_zero_count_cache[4+8*0]= 0; | 971 *(uint32_t*)&h->non_zero_count_cache[4+8*0]= 0; |
972 }else{ | 972 }else{ |
973 | 973 |
974 h->non_zero_count_cache[1+8*0]= | 974 h->non_zero_count_cache[1+8*0]= |
975 h->non_zero_count_cache[2+8*0]= | 975 h->non_zero_count_cache[2+8*0]= |
976 | 976 |
977 h->non_zero_count_cache[1+8*3]= | 977 h->non_zero_count_cache[1+8*3]= |
978 h->non_zero_count_cache[2+8*3]= | 978 h->non_zero_count_cache[2+8*3]= |
979 *(uint32_t*)&h->non_zero_count_cache[4+8*0]= CABAC && !IS_INTRA(mb_type) ? 0 : 0x40404040; | 979 *(uint32_t*)&h->non_zero_count_cache[4+8*0]= CABAC && !IS_INTRA(mb_type) ? 0 : 0x40404040; |
980 } | 980 } |
981 | 981 |
982 } | 982 } |
983 | 983 |
984 for (i=0; i<2; i++) { | 984 for (i=0; i<2; i++) { |
985 if(left_type[i]){ | 985 if(left_type[i]){ |
986 h->non_zero_count_cache[3+8*1 + 2*8*i]= h->non_zero_count[left_xy[i]][left_block[8+0+2*i]]; | 986 h->non_zero_count_cache[3+8*1 + 2*8*i]= h->non_zero_count[left_xy[i]][left_block[8+0+2*i]]; |
987 h->non_zero_count_cache[3+8*2 + 2*8*i]= h->non_zero_count[left_xy[i]][left_block[8+1+2*i]]; | 987 h->non_zero_count_cache[3+8*2 + 2*8*i]= h->non_zero_count[left_xy[i]][left_block[8+1+2*i]]; |
988 if(!for_deblock){ | 988 if(!for_deblock){ |
989 h->non_zero_count_cache[0+8*1 + 8*i]= h->non_zero_count[left_xy[i]][left_block[8+4+2*i]]; | 989 h->non_zero_count_cache[0+8*1 + 8*i]= h->non_zero_count[left_xy[i]][left_block[8+4+2*i]]; |
990 h->non_zero_count_cache[0+8*4 + 8*i]= h->non_zero_count[left_xy[i]][left_block[8+5+2*i]]; | 990 h->non_zero_count_cache[0+8*4 + 8*i]= h->non_zero_count[left_xy[i]][left_block[8+5+2*i]]; |
991 } | 991 } |
992 }else{ | 992 }else{ |
993 if(for_deblock){ | 993 if(for_deblock){ |
994 h->non_zero_count_cache[3+8*1 + 2*8*i]= | 994 h->non_zero_count_cache[3+8*1 + 2*8*i]= |
995 h->non_zero_count_cache[3+8*2 + 2*8*i]= 0; | 995 h->non_zero_count_cache[3+8*2 + 2*8*i]= 0; |
996 }else{ | 996 }else{ |
997 h->non_zero_count_cache[3+8*1 + 2*8*i]= | 997 h->non_zero_count_cache[3+8*1 + 2*8*i]= |
998 h->non_zero_count_cache[3+8*2 + 2*8*i]= | 998 h->non_zero_count_cache[3+8*2 + 2*8*i]= |
999 h->non_zero_count_cache[0+8*1 + 8*i]= | 999 h->non_zero_count_cache[0+8*1 + 8*i]= |
1000 h->non_zero_count_cache[0+8*4 + 8*i]= CABAC && !IS_INTRA(mb_type) ? 0 : 64; | 1000 h->non_zero_count_cache[0+8*4 + 8*i]= CABAC && !IS_INTRA(mb_type) ? 0 : 64; |
1001 } | 1001 } |
1002 } | 1002 } |
1003 } | 1003 } |
1004 | 1004 |
1005 // CAVLC 8x8dct requires NNZ values for residual decoding that differ from what the loop filter needs | 1005 // CAVLC 8x8dct requires NNZ values for residual decoding that differ from what the loop filter needs |
1085 h->ref_cache[list][scan8[0] + 0 - 1*8]= | 1085 h->ref_cache[list][scan8[0] + 0 - 1*8]= |
1086 h->ref_cache[list][scan8[0] + 1 - 1*8]= ref2frm[list][s->current_picture.ref_index[list][b8_xy + 0]]; | 1086 h->ref_cache[list][scan8[0] + 1 - 1*8]= ref2frm[list][s->current_picture.ref_index[list][b8_xy + 0]]; |
1087 h->ref_cache[list][scan8[0] + 2 - 1*8]= | 1087 h->ref_cache[list][scan8[0] + 2 - 1*8]= |
1088 h->ref_cache[list][scan8[0] + 3 - 1*8]= ref2frm[list][s->current_picture.ref_index[list][b8_xy + 1]]; | 1088 h->ref_cache[list][scan8[0] + 3 - 1*8]= ref2frm[list][s->current_picture.ref_index[list][b8_xy + 1]]; |
1089 }else{ | 1089 }else{ |
1090 h->ref_cache[list][scan8[0] + 0 - 1*8]= | 1090 h->ref_cache[list][scan8[0] + 0 - 1*8]= |
1091 h->ref_cache[list][scan8[0] + 1 - 1*8]= s->current_picture.ref_index[list][b8_xy + 0]; | 1091 h->ref_cache[list][scan8[0] + 1 - 1*8]= s->current_picture.ref_index[list][b8_xy + 0]; |
1092 h->ref_cache[list][scan8[0] + 2 - 1*8]= | 1092 h->ref_cache[list][scan8[0] + 2 - 1*8]= |
1093 h->ref_cache[list][scan8[0] + 3 - 1*8]= s->current_picture.ref_index[list][b8_xy + 1]; | 1093 h->ref_cache[list][scan8[0] + 3 - 1*8]= s->current_picture.ref_index[list][b8_xy + 1]; |
1094 } | 1094 } |
1095 }else{ | 1095 }else{ |
1096 *(uint32_t*)h->mv_cache [list][scan8[0] + 0 - 1*8]= | 1096 *(uint32_t*)h->mv_cache [list][scan8[0] + 0 - 1*8]= |
1097 *(uint32_t*)h->mv_cache [list][scan8[0] + 1 - 1*8]= | 1097 *(uint32_t*)h->mv_cache [list][scan8[0] + 1 - 1*8]= |
1098 *(uint32_t*)h->mv_cache [list][scan8[0] + 2 - 1*8]= | 1098 *(uint32_t*)h->mv_cache [list][scan8[0] + 2 - 1*8]= |
1110 if(for_deblock){ | 1110 if(for_deblock){ |
1111 int (*ref2frm)[64] = h->ref2frm[ h->slice_table[left_xy[i]]&(MAX_SLICES-1) ][0] + (MB_MBAFF ? 20 : 2); | 1111 int (*ref2frm)[64] = h->ref2frm[ h->slice_table[left_xy[i]]&(MAX_SLICES-1) ][0] + (MB_MBAFF ? 20 : 2); |
1112 h->ref_cache[list][cache_idx ]= ref2frm[list][s->current_picture.ref_index[list][b8_xy + h->b8_stride*(left_block[0+i*2]>>1)]]; | 1112 h->ref_cache[list][cache_idx ]= ref2frm[list][s->current_picture.ref_index[list][b8_xy + h->b8_stride*(left_block[0+i*2]>>1)]]; |
1113 h->ref_cache[list][cache_idx+8]= ref2frm[list][s->current_picture.ref_index[list][b8_xy + h->b8_stride*(left_block[1+i*2]>>1)]]; | 1113 h->ref_cache[list][cache_idx+8]= ref2frm[list][s->current_picture.ref_index[list][b8_xy + h->b8_stride*(left_block[1+i*2]>>1)]]; |
1114 }else{ | 1114 }else{ |
1115 h->ref_cache[list][cache_idx ]= s->current_picture.ref_index[list][b8_xy + h->b8_stride*(left_block[0+i*2]>>1)]; | 1115 h->ref_cache[list][cache_idx ]= s->current_picture.ref_index[list][b8_xy + h->b8_stride*(left_block[0+i*2]>>1)]; |
1116 h->ref_cache[list][cache_idx+8]= s->current_picture.ref_index[list][b8_xy + h->b8_stride*(left_block[1+i*2]>>1)]; | 1116 h->ref_cache[list][cache_idx+8]= s->current_picture.ref_index[list][b8_xy + h->b8_stride*(left_block[1+i*2]>>1)]; |
1117 } | 1117 } |
1118 }else{ | 1118 }else{ |
1119 *(uint32_t*)h->mv_cache [list][cache_idx ]= | 1119 *(uint32_t*)h->mv_cache [list][cache_idx ]= |
1120 *(uint32_t*)h->mv_cache [list][cache_idx+8]= 0; | 1120 *(uint32_t*)h->mv_cache [list][cache_idx+8]= 0; |
1121 h->ref_cache[list][cache_idx ]= | 1121 h->ref_cache[list][cache_idx ]= |
1260 } | 1260 } |
1261 } | 1261 } |
1262 #endif | 1262 #endif |
1263 | 1263 |
1264 if(!for_deblock) | 1264 if(!for_deblock) |
1265 h->neighbor_transform_size= !!IS_8x8DCT(top_type) + !!IS_8x8DCT(left_type[0]); | 1265 h->neighbor_transform_size= !!IS_8x8DCT(top_type) + !!IS_8x8DCT(left_type[0]); |
1266 return 0; | 1266 return 0; |
1267 } | 1267 } |
1268 | 1268 |
1269 static void fill_decode_caches(H264Context *h, int mb_type){ | 1269 static void fill_decode_caches(H264Context *h, int mb_type){ |
1270 fill_caches(h, mb_type, 0); | 1270 fill_caches(h, mb_type, 0); |