comparison h264.c @ 7494:b0a840bb7b12 libavcodec

indent
author michael
date Tue, 05 Aug 2008 11:04:49 +0000
parents e5b93d01b472
children 2090d67bbf16
comparison
equal deleted inserted replaced
7493:e5b93d01b472 7494:b0a840bb7b12
1009 } 1009 }
1010 }else{ // AFR/FR -> AFR/FR 1010 }else{ // AFR/FR -> AFR/FR
1011 single_col: 1011 single_col:
1012 mb_type_col[0] = 1012 mb_type_col[0] =
1013 mb_type_col[1] = h->ref_list[1][0].mb_type[mb_xy]; 1013 mb_type_col[1] = h->ref_list[1][0].mb_type[mb_xy];
1014 if(IS_8X8(mb_type_col[0]) && !h->sps.direct_8x8_inference_flag){ 1014 if(IS_8X8(mb_type_col[0]) && !h->sps.direct_8x8_inference_flag){
1015 /* FIXME save sub mb types from previous frames (or derive from MVs) 1015 /* FIXME save sub mb types from previous frames (or derive from MVs)
1016 * so we know exactly what block size to use */ 1016 * so we know exactly what block size to use */
1017 sub_mb_type = MB_TYPE_8x8|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; /* B_SUB_4x4 */ 1017 sub_mb_type = MB_TYPE_8x8|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; /* B_SUB_4x4 */
1018 *mb_type |= MB_TYPE_8x8|MB_TYPE_L0L1; 1018 *mb_type |= MB_TYPE_8x8|MB_TYPE_L0L1;
1019 }else if(!is_b8x8 && (mb_type_col[0] & MB_TYPE_16x16_OR_INTRA)){ 1019 }else if(!is_b8x8 && (mb_type_col[0] & MB_TYPE_16x16_OR_INTRA)){
1020 sub_mb_type = MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; /* B_SUB_8x8 */ 1020 sub_mb_type = MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; /* B_SUB_8x8 */
1021 *mb_type |= MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; /* B_16x16 */ 1021 *mb_type |= MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; /* B_16x16 */
1022 }else{ 1022 }else{
1023 sub_mb_type = MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; /* B_SUB_8x8 */ 1023 sub_mb_type = MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; /* B_SUB_8x8 */
1024 *mb_type |= MB_TYPE_8x8|MB_TYPE_L0L1; 1024 *mb_type |= MB_TYPE_8x8|MB_TYPE_L0L1;
1025 } 1025 }
1026 } 1026 }
1027 } 1027 }
1028 1028
1029 if(b8_stride){ 1029 if(b8_stride){
1030 l1mv0 = &h->ref_list[1][0].motion_val[0][h->mb2b_xy [mb_xy]]; 1030 l1mv0 = &h->ref_list[1][0].motion_val[0][h->mb2b_xy [mb_xy]];
1164 } 1164 }
1165 }else{ /* direct temporal mv pred */ 1165 }else{ /* direct temporal mv pred */
1166 const int *map_col_to_list0[2] = {h->map_col_to_list0[0], h->map_col_to_list0[1]}; 1166 const int *map_col_to_list0[2] = {h->map_col_to_list0[0], h->map_col_to_list0[1]};
1167 const int *dist_scale_factor = h->dist_scale_factor; 1167 const int *dist_scale_factor = h->dist_scale_factor;
1168 1168
1169 if(FRAME_MBAFF && IS_INTERLACED(*mb_type)){ 1169 if(FRAME_MBAFF && IS_INTERLACED(*mb_type)){
1170 map_col_to_list0[0] = h->map_col_to_list0_field[0]; 1170 map_col_to_list0[0] = h->map_col_to_list0_field[0];
1171 map_col_to_list0[1] = h->map_col_to_list0_field[1]; 1171 map_col_to_list0[1] = h->map_col_to_list0_field[1];
1172 dist_scale_factor = h->dist_scale_factor_field; 1172 dist_scale_factor = h->dist_scale_factor_field;
1173 } 1173 }
1174 if(IS_INTERLACED(*mb_type) != IS_INTERLACED(mb_type_col[0])){ 1174 if(IS_INTERLACED(*mb_type) != IS_INTERLACED(mb_type_col[0])){
1175 /* FIXME assumes direct_8x8_inference == 1 */ 1175 /* FIXME assumes direct_8x8_inference == 1 */
1176 int y_shift; 1176 int y_shift;
1177 int ref_shift; 1177 int ref_shift;
1178 1178
1179 if(IS_INTERLACED(*mb_type)){ 1179 if(IS_INTERLACED(*mb_type)){
1180 /* frame to field scaling */ 1180 /* frame to field scaling */
1181 y_shift = 0; 1181 y_shift = 0;
1182 ref_shift= FRAME_MBAFF ? 0 : 1; 1182 ref_shift= FRAME_MBAFF ? 0 : 1;
1183 }else{ 1183 }else{
1184 y_shift = 2; 1184 y_shift = 2;
1185 ref_shift= FRAME_MBAFF ? 2 : 1; 1185 ref_shift= FRAME_MBAFF ? 2 : 1;
1186 } 1186 }
1187 1187
1188 for(i8=0; i8<4; i8++){ 1188 for(i8=0; i8<4; i8++){
1189 const int x8 = i8&1; 1189 const int x8 = i8&1;
1190 const int y8 = i8>>1; 1190 const int y8 = i8>>1;
1191 int ref0, scale; 1191 int ref0, scale;
1192 const int16_t (*l1mv)[2]= l1mv0; 1192 const int16_t (*l1mv)[2]= l1mv0;
1193 1193
1194 if(is_b8x8 && !IS_DIRECT(h->sub_mb_type[i8])) 1194 if(is_b8x8 && !IS_DIRECT(h->sub_mb_type[i8]))
1195 continue; 1195 continue;
1196 h->sub_mb_type[i8] = sub_mb_type; 1196 h->sub_mb_type[i8] = sub_mb_type;
1197 1197
1198 fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, 0, 1); 1198 fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, 0, 1);
1199 if(IS_INTRA(mb_type_col[y8])){ 1199 if(IS_INTRA(mb_type_col[y8])){
1200 fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, 0, 1); 1200 fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, 0, 1);
1201 fill_rectangle(&h-> mv_cache[0][scan8[i8*4]], 2, 2, 8, 0, 4); 1201 fill_rectangle(&h-> mv_cache[0][scan8[i8*4]], 2, 2, 8, 0, 4);
1202 fill_rectangle(&h-> mv_cache[1][scan8[i8*4]], 2, 2, 8, 0, 4); 1202 fill_rectangle(&h-> mv_cache[1][scan8[i8*4]], 2, 2, 8, 0, 4);
1203 continue; 1203 continue;
1204 } 1204 }
1205 1205
1206 ref0 = l1ref0[x8 + y8*b8_stride]; 1206 ref0 = l1ref0[x8 + y8*b8_stride];
1207 if(ref0 >= 0) 1207 if(ref0 >= 0)
1208 ref0 = map_col_to_list0[0][ref0*2>>ref_shift]; 1208 ref0 = map_col_to_list0[0][ref0*2>>ref_shift];
1209 else{ 1209 else{
1210 ref0 = map_col_to_list0[1][l1ref1[x8 + y8*b8_stride]*2>>ref_shift]; 1210 ref0 = map_col_to_list0[1][l1ref1[x8 + y8*b8_stride]*2>>ref_shift];
1211 l1mv= l1mv1; 1211 l1mv= l1mv1;
1212 } 1212 }
1213 scale = dist_scale_factor[ref0]; 1213 scale = dist_scale_factor[ref0];
1214 fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, ref0, 1); 1214 fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, ref0, 1);
1215 1215
1216 { 1216 {
1217 const int16_t *mv_col = l1mv[x8*3 + y8*b4_stride]; 1217 const int16_t *mv_col = l1mv[x8*3 + y8*b4_stride];
1218 int my_col = (mv_col[1]<<y_shift)/2; 1218 int my_col = (mv_col[1]<<y_shift)/2;
1219 int mx = (scale * mv_col[0] + 128) >> 8; 1219 int mx = (scale * mv_col[0] + 128) >> 8;
1220 int my = (scale * my_col + 128) >> 8; 1220 int my = (scale * my_col + 128) >> 8;
1221 fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, pack16to32(mx,my), 4); 1221 fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, pack16to32(mx,my), 4);
1222 fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, pack16to32(mx-mv_col[0],my-my_col), 4); 1222 fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, pack16to32(mx-mv_col[0],my-my_col), 4);
1223 } 1223 }
1224 } 1224 }
1225 return; 1225 return;
1226 } 1226 }
1227 1227
1228 /* one-to-one mv scaling */ 1228 /* one-to-one mv scaling */
1229 1229
1230 if(IS_16X16(*mb_type)){ 1230 if(IS_16X16(*mb_type)){
1231 int ref, mv0, mv1; 1231 int ref, mv0, mv1;