History

lavc/hevc/ps: reindent

Anton Khirnov committed 2 years ago

Commit 81e9afa1 parent 7d245861 file · +86 −86Browse files

Showing the changes to libavcodec (1 of 1 file). Show all

Unified · Split

libavcodec/hevc/ps.c+86−86
@@ -1185,10 +1185,10 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id, · 1184 unmodified lines
1185 }1185 }
1186 1186
1187 if (!multi_layer_ext) {1187 if (!multi_layer_ext) {
1188 sps->temporal_id_nesting = get_bits(gb, 1);1188 sps->temporal_id_nesting = get_bits(gb, 1);
1189 1189
1190 if ((ret = parse_ptl(gb, avctx, 1, &sps->ptl, sps->max_sub_layers)) < 0)1190 if ((ret = parse_ptl(gb, avctx, 1, &sps->ptl, sps->max_sub_layers)) < 0)
1191 return ret;1191 return ret;
1192 } else {1192 } else {
1193 sps->temporal_id_nesting = sps->max_sub_layers > 1 ?1193 sps->temporal_id_nesting = sps->max_sub_layers > 1 ?
1194 sps->vps->vps_max_sub_layers : 1;1194 sps->vps->vps_max_sub_layers : 1;
@@ -1222,69 +1222,69 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id, · 27 unmodified lines
1222 sps->pic_conf_win.bottom_offset = rf->conf_win_bottom_offset;1222 sps->pic_conf_win.bottom_offset = rf->conf_win_bottom_offset;
1223 1223
1224 } else {1224 } else {
1225 sps->chroma_format_idc = get_ue_golomb_long(gb);1225 sps->chroma_format_idc = get_ue_golomb_long(gb);
1226 if (sps->chroma_format_idc > 3U) {1226 if (sps->chroma_format_idc > 3U) {
1227 av_log(avctx, AV_LOG_ERROR, "chroma_format_idc %d is invalid\n", sps->chroma_format_idc);1227 av_log(avctx, AV_LOG_ERROR, "chroma_format_idc %d is invalid\n", sps->chroma_format_idc);
1228 return AVERROR_INVALIDDATA;1228 return AVERROR_INVALIDDATA;
1229 }1229 }
1230
1231 if (sps->chroma_format_idc == 3)
1232 sps->separate_colour_plane = get_bits1(gb);
1233 1230
1234 if (sps->separate_colour_plane)1231 if (sps->chroma_format_idc == 3)
1235 sps->chroma_format_idc = 0;1232 sps->separate_colour_plane = get_bits1(gb);
1236 1233
1237 sps->width = get_ue_golomb_long(gb);1234 if (sps->separate_colour_plane)
1238 sps->height = get_ue_golomb_long(gb);1235 sps->chroma_format_idc = 0;
1239 if ((ret = av_image_check_size(sps->width,
1240 sps->height, 0, avctx)) < 0)
1241 return ret;
1242 1236
1243 sps->conformance_window = get_bits1(gb);1237 sps->width = get_ue_golomb_long(gb);
1244 if (sps->conformance_window) {1238 sps->height = get_ue_golomb_long(gb);
1245 int vert_mult = hevc_sub_height_c[sps->chroma_format_idc];1239 if ((ret = av_image_check_size(sps->width,
1246 int horiz_mult = hevc_sub_width_c[sps->chroma_format_idc];1240 sps->height, 0, avctx)) < 0)
1247 sps->pic_conf_win.left_offset = get_ue_golomb_long(gb) * horiz_mult;1241 return ret;
1248 sps->pic_conf_win.right_offset = get_ue_golomb_long(gb) * horiz_mult;
1249 sps->pic_conf_win.top_offset = get_ue_golomb_long(gb) * vert_mult;
1250 sps->pic_conf_win.bottom_offset = get_ue_golomb_long(gb) * vert_mult;
1251
1252 if (avctx->flags2 & AV_CODEC_FLAG2_IGNORE_CROP) {
1253 av_log(avctx, AV_LOG_DEBUG,
1254 "discarding sps conformance window, "
1255 "original values are l:%u r:%u t:%u b:%u\n",
1256 sps->pic_conf_win.left_offset,
1257 sps->pic_conf_win.right_offset,
1258 sps->pic_conf_win.top_offset,
1259 sps->pic_conf_win.bottom_offset);
1260 1242
1261 sps->pic_conf_win.left_offset =1243 sps->conformance_window = get_bits1(gb);
1262 sps->pic_conf_win.right_offset =1244 if (sps->conformance_window) {
1263 sps->pic_conf_win.top_offset =1245 int vert_mult = hevc_sub_height_c[sps->chroma_format_idc];
1264 sps->pic_conf_win.bottom_offset = 0;1246 int horiz_mult = hevc_sub_width_c[sps->chroma_format_idc];
1247 sps->pic_conf_win.left_offset = get_ue_golomb_long(gb) * horiz_mult;
1248 sps->pic_conf_win.right_offset = get_ue_golomb_long(gb) * horiz_mult;
1249 sps->pic_conf_win.top_offset = get_ue_golomb_long(gb) * vert_mult;
1250 sps->pic_conf_win.bottom_offset = get_ue_golomb_long(gb) * vert_mult;
1251
1252 if (avctx->flags2 & AV_CODEC_FLAG2_IGNORE_CROP) {
1253 av_log(avctx, AV_LOG_DEBUG,
1254 "discarding sps conformance window, "
1255 "original values are l:%u r:%u t:%u b:%u\n",
1256 sps->pic_conf_win.left_offset,
1257 sps->pic_conf_win.right_offset,
1258 sps->pic_conf_win.top_offset,
1259 sps->pic_conf_win.bottom_offset);
1260
1261 sps->pic_conf_win.left_offset =
1262 sps->pic_conf_win.right_offset =
1263 sps->pic_conf_win.top_offset =
1264 sps->pic_conf_win.bottom_offset = 0;
1265 }
1265 }1266 }
1266 }
1267 1267
1268 sps->bit_depth = get_ue_golomb_31(gb) + 8;1268 sps->bit_depth = get_ue_golomb_31(gb) + 8;
1269 if (sps->bit_depth > 16) {1269 if (sps->bit_depth > 16) {
1270 av_log(avctx, AV_LOG_ERROR, "Luma bit depth (%d) is out of range\n",1270 av_log(avctx, AV_LOG_ERROR, "Luma bit depth (%d) is out of range\n",
1271 sps->bit_depth);1271 sps->bit_depth);
1272 return AVERROR_INVALIDDATA;1272 return AVERROR_INVALIDDATA;
1273 }1273 }
1274 bit_depth_chroma = get_ue_golomb_31(gb) + 8;1274 bit_depth_chroma = get_ue_golomb_31(gb) + 8;
1275 if (bit_depth_chroma > 16) {1275 if (bit_depth_chroma > 16) {
1276 av_log(avctx, AV_LOG_ERROR, "Chroma bit depth (%d) is out of range\n",1276 av_log(avctx, AV_LOG_ERROR, "Chroma bit depth (%d) is out of range\n",
1277 bit_depth_chroma);1277 bit_depth_chroma);
1278 return AVERROR_INVALIDDATA;1278 return AVERROR_INVALIDDATA;
1279 }1279 }
1280 if (sps->chroma_format_idc && bit_depth_chroma != sps->bit_depth) {1280 if (sps->chroma_format_idc && bit_depth_chroma != sps->bit_depth) {
1281 av_log(avctx, AV_LOG_ERROR,1281 av_log(avctx, AV_LOG_ERROR,
1282 "Luma bit depth (%d) is different from chroma bit depth (%d), "1282 "Luma bit depth (%d) is different from chroma bit depth (%d), "
1283 "this is unsupported.\n",1283 "this is unsupported.\n",
1284 sps->bit_depth, bit_depth_chroma);1284 sps->bit_depth, bit_depth_chroma);
1285 return AVERROR_INVALIDDATA;1285 return AVERROR_INVALIDDATA;
1286 }1286 }
1287 sps->bit_depth_chroma = bit_depth_chroma;1287 sps->bit_depth_chroma = bit_depth_chroma;
1288 }1288 }
1289 1289
1290 sps->output_window = sps->pic_conf_win;1290 sps->output_window = sps->pic_conf_win;
@@ -1301,37 +1301,37 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id, · 10 unmodified lines
1301 }1301 }
1302 1302
1303 if (!multi_layer_ext) {1303 if (!multi_layer_ext) {
1304 int start;1304 int start;
1305 1305
1306 sps->sublayer_ordering_info = get_bits1(gb);1306 sps->sublayer_ordering_info = get_bits1(gb);
1307 start = sps->sublayer_ordering_info ? 0 : sps->max_sub_layers - 1;1307 start = sps->sublayer_ordering_info ? 0 : sps->max_sub_layers - 1;
1308 for (i = start; i < sps->max_sub_layers; i++) {1308 for (i = start; i < sps->max_sub_layers; i++) {
1309 sps->temporal_layer[i].max_dec_pic_buffering = get_ue_golomb_long(gb) + 1;1309 sps->temporal_layer[i].max_dec_pic_buffering = get_ue_golomb_long(gb) + 1;
1310 sps->temporal_layer[i].num_reorder_pics = get_ue_golomb_long(gb);1310 sps->temporal_layer[i].num_reorder_pics = get_ue_golomb_long(gb);
1311 sps->temporal_layer[i].max_latency_increase = get_ue_golomb_long(gb) - 1;1311 sps->temporal_layer[i].max_latency_increase = get_ue_golomb_long(gb) - 1;
1312 if (sps->temporal_layer[i].max_dec_pic_buffering > (unsigned)HEVC_MAX_DPB_SIZE) {1312 if (sps->temporal_layer[i].max_dec_pic_buffering > (unsigned)HEVC_MAX_DPB_SIZE) {
1313 av_log(avctx, AV_LOG_ERROR, "sps_max_dec_pic_buffering_minus1 out of range: %d\n",1313 av_log(avctx, AV_LOG_ERROR, "sps_max_dec_pic_buffering_minus1 out of range: %d\n",
1314 sps->temporal_layer[i].max_dec_pic_buffering - 1U);1314 sps->temporal_layer[i].max_dec_pic_buffering - 1U);
1315 return AVERROR_INVALIDDATA;
1316 }
1317 if (sps->temporal_layer[i].num_reorder_pics > sps->temporal_layer[i].max_dec_pic_buffering - 1) {
1318 av_log(avctx, AV_LOG_WARNING, "sps_max_num_reorder_pics out of range: %d\n",
1319 sps->temporal_layer[i].num_reorder_pics);
1320 if (avctx->err_recognition & AV_EF_EXPLODE ||
1321 sps->temporal_layer[i].num_reorder_pics > HEVC_MAX_DPB_SIZE - 1) {
1322 return AVERROR_INVALIDDATA;1315 return AVERROR_INVALIDDATA;
1323 }1316 }
1324 sps->temporal_layer[i].max_dec_pic_buffering = sps->temporal_layer[i].num_reorder_pics + 1;1317 if (sps->temporal_layer[i].num_reorder_pics > sps->temporal_layer[i].max_dec_pic_buffering - 1) {
1318 av_log(avctx, AV_LOG_WARNING, "sps_max_num_reorder_pics out of range: %d\n",
1319 sps->temporal_layer[i].num_reorder_pics);
1320 if (avctx->err_recognition & AV_EF_EXPLODE ||
1321 sps->temporal_layer[i].num_reorder_pics > HEVC_MAX_DPB_SIZE - 1) {
1322 return AVERROR_INVALIDDATA;
1323 }
1324 sps->temporal_layer[i].max_dec_pic_buffering = sps->temporal_layer[i].num_reorder_pics + 1;
1325 }
1325 }1326 }
1326 }
1327 1327
1328 if (!sps->sublayer_ordering_info) {1328 if (!sps->sublayer_ordering_info) {
1329 for (i = 0; i < start; i++) {1329 for (i = 0; i < start; i++) {
1330 sps->temporal_layer[i].max_dec_pic_buffering = sps->temporal_layer[start].max_dec_pic_buffering;1330 sps->temporal_layer[i].max_dec_pic_buffering = sps->temporal_layer[start].max_dec_pic_buffering;
1331 sps->temporal_layer[i].num_reorder_pics = sps->temporal_layer[start].num_reorder_pics;1331 sps->temporal_layer[i].num_reorder_pics = sps->temporal_layer[start].num_reorder_pics;
1332 sps->temporal_layer[i].max_latency_increase = sps->temporal_layer[start].max_latency_increase;1332 sps->temporal_layer[i].max_latency_increase = sps->temporal_layer[start].max_latency_increase;
1333 }
1333 }1334 }
1334 }
1335 } else {1335 } else {
1336 for (int i = 0; i < sps->max_sub_layers; i++) {1336 for (int i = 0; i < sps->max_sub_layers; i++) {
1337 sps->temporal_layer[i].max_dec_pic_buffering = sps->vps->dpb_size.max_dec_pic_buffering;1337 sps->temporal_layer[i].max_dec_pic_buffering = sps->vps->dpb_size.max_dec_pic_buffering;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t