Mercurial > libavcodec.hg
comparison h264.c @ 7493:e5b93d01b472 libavcodec
Factorize some code between temporal and spatial direct mode.
author | michael |
---|---|
date | Tue, 05 Aug 2008 11:00:17 +0000 |
parents | a5bc797cbc49 |
children | b0a840bb7b12 |
comparison
equal
deleted
inserted
replaced
7492:50e0b25882cd | 7493:e5b93d01b472 |
---|---|
952 } | 952 } |
953 } | 953 } |
954 | 954 |
955 static inline void pred_direct_motion(H264Context * const h, int *mb_type){ | 955 static inline void pred_direct_motion(H264Context * const h, int *mb_type){ |
956 MpegEncContext * const s = &h->s; | 956 MpegEncContext * const s = &h->s; |
957 const int fieldoff= (s->picture_structure & h->ref_list[1][0].reference) ? 0 : (3-2*s->picture_structure); | 957 int b8_stride = h->b8_stride; |
958 const int mb_xy = h->mb_xy + s->mb_stride*fieldoff; | 958 int b4_stride = h->b_stride; |
959 const int b8_xy = 2*s->mb_x + 2*s->mb_y*h->b8_stride + 2*h->b8_stride*fieldoff; | 959 int mb_xy = h->mb_xy; |
960 const int b4_xy = 4*s->mb_x + 4*s->mb_y*h-> b_stride + 4*h-> b_stride*fieldoff; | 960 int mb_type_col[2]; |
961 const int mb_type_col = h->ref_list[1][0].mb_type[mb_xy]; | 961 const int16_t (*l1mv0)[2], (*l1mv1)[2]; |
962 const int16_t (*l1mv0)[2] = (const int16_t (*)[2]) &h->ref_list[1][0].motion_val[0][b4_xy]; | 962 const int8_t *l1ref0, *l1ref1; |
963 const int16_t (*l1mv1)[2] = (const int16_t (*)[2]) &h->ref_list[1][0].motion_val[1][b4_xy]; | |
964 const int8_t *l1ref0 = &h->ref_list[1][0].ref_index[0][b8_xy]; | |
965 const int8_t *l1ref1 = &h->ref_list[1][0].ref_index[1][b8_xy]; | |
966 const int is_b8x8 = IS_8X8(*mb_type); | 963 const int is_b8x8 = IS_8X8(*mb_type); |
967 unsigned int sub_mb_type; | 964 unsigned int sub_mb_type; |
968 int i8, i4; | 965 int i8, i4; |
969 | 966 |
970 #define MB_TYPE_16x16_OR_INTRA (MB_TYPE_16x16|MB_TYPE_INTRA4x4|MB_TYPE_INTRA16x16|MB_TYPE_INTRA_PCM) | 967 #define MB_TYPE_16x16_OR_INTRA (MB_TYPE_16x16|MB_TYPE_INTRA4x4|MB_TYPE_INTRA16x16|MB_TYPE_INTRA_PCM) |
971 if(IS_8X8(mb_type_col) && !h->sps.direct_8x8_inference_flag){ | 968 |
969 if(IS_INTERLACED(h->ref_list[1][0].mb_type[mb_xy])){ // AFL/AFR/FR/FL -> AFL/FL | |
970 if(h->ref_list[1][0].reference == PICT_FRAME){ // AFL/AFR/FR/FL -> AFL | |
971 if(!IS_INTERLACED(*mb_type)){ // AFR/FR -> AFL | |
972 int cur_poc = s->current_picture_ptr->poc; | |
973 int *col_poc = h->ref_list[1]->field_poc; | |
974 int col_parity = FFABS(col_poc[0] - cur_poc) >= FFABS(col_poc[1] - cur_poc); | |
975 mb_xy= s->mb_x + ((s->mb_y&~1) + col_parity)*s->mb_stride; | |
976 l1mv0 = &h->ref_list[1][0].motion_val[0][h->mb2b_xy [mb_xy]]; | |
977 l1mv1 = &h->ref_list[1][0].motion_val[1][h->mb2b_xy [mb_xy]]; | |
978 l1ref0 = &h->ref_list[1][0].ref_index [0][h->mb2b8_xy[mb_xy]]; | |
979 l1ref1 = &h->ref_list[1][0].ref_index [1][h->mb2b8_xy[mb_xy]]; | |
980 if(s->mb_y&1){ | |
981 l1ref0 += b8_stride; | |
982 l1ref1 += b8_stride; | |
983 l1mv0 += 2*b4_stride; | |
984 l1mv1 += 2*b4_stride; | |
985 } | |
986 b8_stride = 0; | |
987 } | |
988 }else if(!(s->picture_structure & h->ref_list[1][0].reference)){// FL -> FL & differ parity | |
989 int fieldoff= 2*(h->ref_list[1][0].reference)-3; | |
990 mb_xy += s->mb_stride*fieldoff; | |
991 } | |
992 goto single_col; | |
993 }else{ // AFL/AFR/FR/FL -> AFR/FR | |
994 if(IS_INTERLACED(*mb_type)){ // AFL /FL -> AFR/FR | |
995 mb_xy= s->mb_x + (s->mb_y&~1)*s->mb_stride; | |
996 mb_type_col[0] = h->ref_list[1][0].mb_type[mb_xy]; | |
997 mb_type_col[1] = h->ref_list[1][0].mb_type[mb_xy + s->mb_stride]; | |
998 b8_stride *= 3; | |
999 b4_stride *= 6; | |
1000 //FIXME IS_8X8(mb_type_col[0]) && !h->sps.direct_8x8_inference_flag | |
1001 if( (mb_type_col[0] & MB_TYPE_16x16_OR_INTRA) | |
1002 && (mb_type_col[1] & MB_TYPE_16x16_OR_INTRA) | |
1003 && !is_b8x8){ | |
1004 sub_mb_type = MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; /* B_SUB_8x8 */ | |
1005 *mb_type |= MB_TYPE_16x8 |MB_TYPE_L0L1|MB_TYPE_DIRECT2; /* B_16x8 */ | |
1006 }else{ | |
1007 sub_mb_type = MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; /* B_SUB_8x8 */ | |
1008 *mb_type |= MB_TYPE_8x8|MB_TYPE_L0L1; | |
1009 } | |
1010 }else{ // AFR/FR -> AFR/FR | |
1011 single_col: | |
1012 mb_type_col[0] = | |
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){ | |
972 /* 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) |
973 * so we know exactly what block size to use */ | 1016 * so we know exactly what block size to use */ |
974 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 */ |
975 *mb_type = MB_TYPE_8x8|MB_TYPE_L0L1; | 1018 *mb_type |= MB_TYPE_8x8|MB_TYPE_L0L1; |
976 }else if(!is_b8x8 && (mb_type_col & MB_TYPE_16x16_OR_INTRA)){ | 1019 }else if(!is_b8x8 && (mb_type_col[0] & MB_TYPE_16x16_OR_INTRA)){ |
977 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 */ |
978 *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 */ |
979 }else{ | 1022 }else{ |
980 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 */ |
981 *mb_type = MB_TYPE_8x8|MB_TYPE_L0L1; | 1024 *mb_type |= MB_TYPE_8x8|MB_TYPE_L0L1; |
982 } | 1025 } |
983 if(!is_b8x8) | 1026 } |
984 *mb_type |= MB_TYPE_DIRECT2; | 1027 } |
985 if(MB_FIELD) | 1028 |
986 *mb_type |= MB_TYPE_INTERLACED; | 1029 if(b8_stride){ |
987 | 1030 l1mv0 = &h->ref_list[1][0].motion_val[0][h->mb2b_xy [mb_xy]]; |
988 tprintf(s->avctx, "mb_type = %08x, sub_mb_type = %08x, is_b8x8 = %d, mb_type_col = %08x\n", *mb_type, sub_mb_type, is_b8x8, mb_type_col); | 1031 l1mv1 = &h->ref_list[1][0].motion_val[1][h->mb2b_xy [mb_xy]]; |
1032 l1ref0 = &h->ref_list[1][0].ref_index [0][h->mb2b8_xy[mb_xy]]; | |
1033 l1ref1 = &h->ref_list[1][0].ref_index [1][h->mb2b8_xy[mb_xy]]; | |
1034 } | |
989 | 1035 |
990 if(h->direct_spatial_mv_pred){ | 1036 if(h->direct_spatial_mv_pred){ |
991 int ref[2]; | 1037 int ref[2]; |
992 int mv[2][2]; | 1038 int mv[2][2]; |
993 int list; | 1039 int list; |
1027 if(!is_b8x8) | 1073 if(!is_b8x8) |
1028 *mb_type &= ~MB_TYPE_L0; | 1074 *mb_type &= ~MB_TYPE_L0; |
1029 sub_mb_type &= ~MB_TYPE_L0; | 1075 sub_mb_type &= ~MB_TYPE_L0; |
1030 } | 1076 } |
1031 | 1077 |
1032 if(IS_INTERLACED(*mb_type) != IS_INTERLACED(mb_type_col)){ | 1078 if(IS_INTERLACED(*mb_type) != IS_INTERLACED(mb_type_col[0])){ |
1033 int pair_xy = s->mb_x + (s->mb_y&~1)*s->mb_stride; | |
1034 int mb_types_col[2]; | |
1035 int b8_stride = h->b8_stride; | |
1036 int b4_stride = h->b_stride; | |
1037 | |
1038 *mb_type = (*mb_type & ~MB_TYPE_16x16) | MB_TYPE_8x8; | |
1039 | |
1040 if(IS_INTERLACED(*mb_type)){ | |
1041 mb_types_col[0] = h->ref_list[1][0].mb_type[pair_xy]; | |
1042 mb_types_col[1] = h->ref_list[1][0].mb_type[pair_xy+s->mb_stride]; | |
1043 if(s->mb_y&1){ | |
1044 l1ref0 -= 2*b8_stride; | |
1045 l1ref1 -= 2*b8_stride; | |
1046 l1mv0 -= 4*b4_stride; | |
1047 l1mv1 -= 4*b4_stride; | |
1048 } | |
1049 b8_stride *= 3; | |
1050 b4_stride *= 6; | |
1051 }else{ | |
1052 int cur_poc = s->current_picture_ptr->poc; | |
1053 int *col_poc = h->ref_list[1]->field_poc; | |
1054 int col_parity = FFABS(col_poc[0] - cur_poc) >= FFABS(col_poc[1] - cur_poc); | |
1055 int dy = 2*col_parity - (s->mb_y&1); | |
1056 mb_types_col[0] = | |
1057 mb_types_col[1] = h->ref_list[1][0].mb_type[pair_xy + col_parity*s->mb_stride]; | |
1058 l1ref0 += dy*b8_stride; | |
1059 l1ref1 += dy*b8_stride; | |
1060 l1mv0 += 2*dy*b4_stride; | |
1061 l1mv1 += 2*dy*b4_stride; | |
1062 b8_stride = 0; | |
1063 } | |
1064 | |
1065 for(i8=0; i8<4; i8++){ | 1079 for(i8=0; i8<4; i8++){ |
1066 int x8 = i8&1; | 1080 int x8 = i8&1; |
1067 int y8 = i8>>1; | 1081 int y8 = i8>>1; |
1068 int xy8 = x8+y8*b8_stride; | 1082 int xy8 = x8+y8*b8_stride; |
1069 int xy4 = 3*x8+y8*b4_stride; | 1083 int xy4 = 3*x8+y8*b4_stride; |
1073 continue; | 1087 continue; |
1074 h->sub_mb_type[i8] = sub_mb_type; | 1088 h->sub_mb_type[i8] = sub_mb_type; |
1075 | 1089 |
1076 fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[0], 1); | 1090 fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[0], 1); |
1077 fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[1], 1); | 1091 fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[1], 1); |
1078 if(!IS_INTRA(mb_types_col[y8]) | 1092 if(!IS_INTRA(mb_type_col[y8]) |
1079 && ( (l1ref0[xy8] == 0 && FFABS(l1mv0[xy4][0]) <= 1 && FFABS(l1mv0[xy4][1]) <= 1) | 1093 && ( (l1ref0[xy8] == 0 && FFABS(l1mv0[xy4][0]) <= 1 && FFABS(l1mv0[xy4][1]) <= 1) |
1080 || (l1ref0[xy8] < 0 && l1ref1[xy8] == 0 && FFABS(l1mv1[xy4][0]) <= 1 && FFABS(l1mv1[xy4][1]) <= 1))){ | 1094 || (l1ref0[xy8] < 0 && l1ref1[xy8] == 0 && FFABS(l1mv1[xy4][0]) <= 1 && FFABS(l1mv1[xy4][1]) <= 1))){ |
1081 if(ref[0] > 0) | 1095 if(ref[0] > 0) |
1082 a= pack16to32(mv[0][0],mv[0][1]); | 1096 a= pack16to32(mv[0][0],mv[0][1]); |
1083 if(ref[1] > 0) | 1097 if(ref[1] > 0) |
1092 }else if(IS_16X16(*mb_type)){ | 1106 }else if(IS_16X16(*mb_type)){ |
1093 int a=0, b=0; | 1107 int a=0, b=0; |
1094 | 1108 |
1095 fill_rectangle(&h->ref_cache[0][scan8[0]], 4, 4, 8, (uint8_t)ref[0], 1); | 1109 fill_rectangle(&h->ref_cache[0][scan8[0]], 4, 4, 8, (uint8_t)ref[0], 1); |
1096 fill_rectangle(&h->ref_cache[1][scan8[0]], 4, 4, 8, (uint8_t)ref[1], 1); | 1110 fill_rectangle(&h->ref_cache[1][scan8[0]], 4, 4, 8, (uint8_t)ref[1], 1); |
1097 if(!IS_INTRA(mb_type_col) | 1111 if(!IS_INTRA(mb_type_col[0]) |
1098 && ( (l1ref0[0] == 0 && FFABS(l1mv0[0][0]) <= 1 && FFABS(l1mv0[0][1]) <= 1) | 1112 && ( (l1ref0[0] == 0 && FFABS(l1mv0[0][0]) <= 1 && FFABS(l1mv0[0][1]) <= 1) |
1099 || (l1ref0[0] < 0 && l1ref1[0] == 0 && FFABS(l1mv1[0][0]) <= 1 && FFABS(l1mv1[0][1]) <= 1 | 1113 || (l1ref0[0] < 0 && l1ref1[0] == 0 && FFABS(l1mv1[0][0]) <= 1 && FFABS(l1mv1[0][1]) <= 1 |
1100 && (h->x264_build>33 || !h->x264_build)))){ | 1114 && (h->x264_build>33 || !h->x264_build)))){ |
1101 if(ref[0] > 0) | 1115 if(ref[0] > 0) |
1102 a= pack16to32(mv[0][0],mv[0][1]); | 1116 a= pack16to32(mv[0][0],mv[0][1]); |
1121 fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, pack16to32(mv[1][0],mv[1][1]), 4); | 1135 fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, pack16to32(mv[1][0],mv[1][1]), 4); |
1122 fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[0], 1); | 1136 fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[0], 1); |
1123 fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[1], 1); | 1137 fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[1], 1); |
1124 | 1138 |
1125 /* col_zero_flag */ | 1139 /* col_zero_flag */ |
1126 if(!IS_INTRA(mb_type_col) && ( l1ref0[x8 + y8*h->b8_stride] == 0 | 1140 if(!IS_INTRA(mb_type_col[0]) && ( l1ref0[x8 + y8*h->b8_stride] == 0 |
1127 || (l1ref0[x8 + y8*h->b8_stride] < 0 && l1ref1[x8 + y8*h->b8_stride] == 0 | 1141 || (l1ref0[x8 + y8*h->b8_stride] < 0 && l1ref1[x8 + y8*h->b8_stride] == 0 |
1128 && (h->x264_build>33 || !h->x264_build)))){ | 1142 && (h->x264_build>33 || !h->x264_build)))){ |
1129 const int16_t (*l1mv)[2]= l1ref0[x8 + y8*h->b8_stride] == 0 ? l1mv0 : l1mv1; | 1143 const int16_t (*l1mv)[2]= l1ref0[x8 + y8*h->b8_stride] == 0 ? l1mv0 : l1mv1; |
1130 if(IS_SUB_8X8(sub_mb_type)){ | 1144 if(IS_SUB_8X8(sub_mb_type)){ |
1131 const int16_t *mv_col = l1mv[x8*3 + y8*3*h->b_stride]; | 1145 const int16_t *mv_col = l1mv[x8*3 + y8*3*h->b_stride]; |
1155 if(FRAME_MBAFF && IS_INTERLACED(*mb_type)){ | 1169 if(FRAME_MBAFF && IS_INTERLACED(*mb_type)){ |
1156 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]; |
1157 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]; |
1158 dist_scale_factor = h->dist_scale_factor_field; | 1172 dist_scale_factor = h->dist_scale_factor_field; |
1159 } | 1173 } |
1160 if(IS_INTERLACED(*mb_type) != IS_INTERLACED(mb_type_col)){ | 1174 if(IS_INTERLACED(*mb_type) != IS_INTERLACED(mb_type_col[0])){ |
1161 /* FIXME assumes direct_8x8_inference == 1 */ | 1175 /* FIXME assumes direct_8x8_inference == 1 */ |
1162 const int pair_xy = s->mb_x + (s->mb_y&~1)*s->mb_stride; | |
1163 int mb_types_col[2]; | |
1164 int b8_stride = h->b8_stride; | |
1165 int b4_stride = h->b_stride; | |
1166 int y_shift; | 1176 int y_shift; |
1167 int ref_shift; | 1177 int ref_shift; |
1168 | 1178 |
1169 *mb_type = MB_TYPE_8x8|MB_TYPE_L0L1 | |
1170 | (is_b8x8 ? 0 : MB_TYPE_DIRECT2) | |
1171 | (*mb_type & MB_TYPE_INTERLACED); | |
1172 sub_mb_type = MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2|MB_TYPE_16x16; | |
1173 | |
1174 if(IS_INTERLACED(*mb_type)){ | 1179 if(IS_INTERLACED(*mb_type)){ |
1175 /* frame to field scaling */ | 1180 /* frame to field scaling */ |
1176 mb_types_col[0] = h->ref_list[1][0].mb_type[pair_xy]; | |
1177 mb_types_col[1] = h->ref_list[1][0].mb_type[pair_xy+s->mb_stride]; | |
1178 if(s->mb_y&1){ | |
1179 l1ref0 -= 2*h->b8_stride; | |
1180 l1ref1 -= 2*h->b8_stride; | |
1181 l1mv0 -= 4*h->b_stride; | |
1182 l1mv1 -= 4*h->b_stride; | |
1183 } | |
1184 y_shift = 0; | 1181 y_shift = 0; |
1185 ref_shift= FRAME_MBAFF ? 0 : 1; | 1182 ref_shift= FRAME_MBAFF ? 0 : 1; |
1186 | |
1187 if( (mb_types_col[0] & MB_TYPE_16x16_OR_INTRA) | |
1188 && (mb_types_col[1] & MB_TYPE_16x16_OR_INTRA) | |
1189 && !is_b8x8) | |
1190 *mb_type |= MB_TYPE_16x8; | |
1191 else | |
1192 *mb_type |= MB_TYPE_8x8; | |
1193 b8_stride *= 3; | |
1194 b4_stride *= 6; | |
1195 }else{ | 1183 }else{ |
1196 int cur_poc = s->current_picture_ptr->poc; | |
1197 int *col_poc = h->ref_list[1]->field_poc; | |
1198 int col_parity = FFABS(col_poc[0] - cur_poc) >= FFABS(col_poc[1] - cur_poc); | |
1199 int dy = 2*col_parity - (s->mb_y&1); | |
1200 mb_types_col[0] = | |
1201 mb_types_col[1] = h->ref_list[1][0].mb_type[pair_xy + col_parity*s->mb_stride]; | |
1202 l1ref0 += dy*h->b8_stride; | |
1203 l1ref1 += dy*h->b8_stride; | |
1204 l1mv0 += 2*dy*h->b_stride; | |
1205 l1mv1 += 2*dy*h->b_stride; | |
1206 y_shift = 2; | 1184 y_shift = 2; |
1207 ref_shift= FRAME_MBAFF ? 2 : 1; | 1185 ref_shift= FRAME_MBAFF ? 2 : 1; |
1208 | |
1209 if((mb_types_col[0] & (MB_TYPE_16x16_OR_INTRA|MB_TYPE_16x8)) | |
1210 && !is_b8x8) | |
1211 *mb_type |= MB_TYPE_16x16; | |
1212 else | |
1213 *mb_type |= MB_TYPE_8x8; | |
1214 b8_stride = 0; | |
1215 } | 1186 } |
1216 | 1187 |
1217 for(i8=0; i8<4; i8++){ | 1188 for(i8=0; i8<4; i8++){ |
1218 const int x8 = i8&1; | 1189 const int x8 = i8&1; |
1219 const int y8 = i8>>1; | 1190 const int y8 = i8>>1; |
1223 if(is_b8x8 && !IS_DIRECT(h->sub_mb_type[i8])) | 1194 if(is_b8x8 && !IS_DIRECT(h->sub_mb_type[i8])) |
1224 continue; | 1195 continue; |
1225 h->sub_mb_type[i8] = sub_mb_type; | 1196 h->sub_mb_type[i8] = sub_mb_type; |
1226 | 1197 |
1227 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); |
1228 if(IS_INTRA(mb_types_col[y8])){ | 1199 if(IS_INTRA(mb_type_col[y8])){ |
1229 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); |
1230 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); |
1231 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); |
1232 continue; | 1203 continue; |
1233 } | 1204 } |
1258 | 1229 |
1259 if(IS_16X16(*mb_type)){ | 1230 if(IS_16X16(*mb_type)){ |
1260 int ref, mv0, mv1; | 1231 int ref, mv0, mv1; |
1261 | 1232 |
1262 fill_rectangle(&h->ref_cache[1][scan8[0]], 4, 4, 8, 0, 1); | 1233 fill_rectangle(&h->ref_cache[1][scan8[0]], 4, 4, 8, 0, 1); |
1263 if(IS_INTRA(mb_type_col)){ | 1234 if(IS_INTRA(mb_type_col[0])){ |
1264 ref=mv0=mv1=0; | 1235 ref=mv0=mv1=0; |
1265 }else{ | 1236 }else{ |
1266 const int ref0 = l1ref0[0] >= 0 ? map_col_to_list0[0][l1ref0[0]] | 1237 const int ref0 = l1ref0[0] >= 0 ? map_col_to_list0[0][l1ref0[0]] |
1267 : map_col_to_list0[1][l1ref1[0]]; | 1238 : map_col_to_list0[1][l1ref1[0]]; |
1268 const int scale = dist_scale_factor[ref0]; | 1239 const int scale = dist_scale_factor[ref0]; |
1286 | 1257 |
1287 if(is_b8x8 && !IS_DIRECT(h->sub_mb_type[i8])) | 1258 if(is_b8x8 && !IS_DIRECT(h->sub_mb_type[i8])) |
1288 continue; | 1259 continue; |
1289 h->sub_mb_type[i8] = sub_mb_type; | 1260 h->sub_mb_type[i8] = sub_mb_type; |
1290 fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, 0, 1); | 1261 fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, 0, 1); |
1291 if(IS_INTRA(mb_type_col)){ | 1262 if(IS_INTRA(mb_type_col[0])){ |
1292 fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, 0, 1); | 1263 fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, 0, 1); |
1293 fill_rectangle(&h-> mv_cache[0][scan8[i8*4]], 2, 2, 8, 0, 4); | 1264 fill_rectangle(&h-> mv_cache[0][scan8[i8*4]], 2, 2, 8, 0, 4); |
1294 fill_rectangle(&h-> mv_cache[1][scan8[i8*4]], 2, 2, 8, 0, 4); | 1265 fill_rectangle(&h-> mv_cache[1][scan8[i8*4]], 2, 2, 8, 0, 4); |
1295 continue; | 1266 continue; |
1296 } | 1267 } |
4341 mb_type|= MB_TYPE_INTERLACED; | 4312 mb_type|= MB_TYPE_INTERLACED; |
4342 | 4313 |
4343 if( h->slice_type_nos == FF_B_TYPE ) | 4314 if( h->slice_type_nos == FF_B_TYPE ) |
4344 { | 4315 { |
4345 // just for fill_caches. pred_direct_motion will set the real mb_type | 4316 // just for fill_caches. pred_direct_motion will set the real mb_type |
4346 mb_type|= MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2|MB_TYPE_SKIP; | 4317 mb_type|= MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2|MB_TYPE_SKIP; |
4347 | 4318 |
4348 fill_caches(h, mb_type, 0); //FIXME check what is needed and what not ... | 4319 fill_caches(h, mb_type, 0); //FIXME check what is needed and what not ... |
4349 pred_direct_motion(h, &mb_type); | 4320 pred_direct_motion(h, &mb_type); |
4350 mb_type|= MB_TYPE_SKIP; | 4321 mb_type|= MB_TYPE_SKIP; |
4351 } | 4322 } |