History

lavc/hevc/ps: reindent

Anton Khirnov committed 2 years ago

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

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
11851185 }
11861186
11871187 if (!multi_layer_ext) {
1188− sps->temporal_id_nesting = get_bits(gb, 1);
1188+ sps->temporal_id_nesting = get_bits(gb, 1);
11891189
1190− if ((ret = parse_ptl(gb, avctx, 1, &sps->ptl, sps->max_sub_layers)) < 0)
1191− return ret;
1190+ if ((ret = parse_ptl(gb, avctx, 1, &sps->ptl, sps->max_sub_layers)) < 0)
1191+ return ret;
11921192 } else {
11931193 sps->temporal_id_nesting = sps->max_sub_layers > 1 ?
11941194 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
12221222 sps->pic_conf_win.bottom_offset = rf->conf_win_bottom_offset;
12231223
12241224 } else {
1225− sps->chroma_format_idc = get_ue_golomb_long(gb);
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);
1228− return AVERROR_INVALIDDATA;
1229− }
1230−
1231− if (sps->chroma_format_idc == 3)
1232− sps->separate_colour_plane = get_bits1(gb);
1225+ sps->chroma_format_idc = get_ue_golomb_long(gb);
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);
1228+ return AVERROR_INVALIDDATA;
1229+ }
12331230
1234− if (sps->separate_colour_plane)
1235− sps->chroma_format_idc = 0;
1231+ if (sps->chroma_format_idc == 3)
1232+ sps->separate_colour_plane = get_bits1(gb);
12361233
1237− sps->width = get_ue_golomb_long(gb);
1238− sps->height = get_ue_golomb_long(gb);
1239− if ((ret = av_image_check_size(sps->width,
1240− sps->height, 0, avctx)) < 0)
1241− return ret;
1234+ if (sps->separate_colour_plane)
1235+ sps->chroma_format_idc = 0;
12421236
1243− sps->conformance_window = get_bits1(gb);
1244− if (sps->conformance_window) {
1245− int vert_mult = hevc_sub_height_c[sps->chroma_format_idc];
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);
1237+ sps->width = get_ue_golomb_long(gb);
1238+ sps->height = get_ue_golomb_long(gb);
1239+ if ((ret = av_image_check_size(sps->width,
1240+ sps->height, 0, avctx)) < 0)
1241+ return ret;
12601242
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;
1243+ sps->conformance_window = get_bits1(gb);
1244+ if (sps->conformance_window) {
1245+ int vert_mult = hevc_sub_height_c[sps->chroma_format_idc];
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+ }
12651266 }
1266− }
12671267
1268− sps->bit_depth = get_ue_golomb_31(gb) + 8;
1269− if (sps->bit_depth > 16) {
1270− av_log(avctx, AV_LOG_ERROR, "Luma bit depth (%d) is out of range\n",
1271− sps->bit_depth);
1272− return AVERROR_INVALIDDATA;
1273− }
1274− bit_depth_chroma = get_ue_golomb_31(gb) + 8;
1275− if (bit_depth_chroma > 16) {
1276− av_log(avctx, AV_LOG_ERROR, "Chroma bit depth (%d) is out of range\n",
1277− bit_depth_chroma);
1278− return AVERROR_INVALIDDATA;
1279− }
1280− if (sps->chroma_format_idc && bit_depth_chroma != sps->bit_depth) {
1281− av_log(avctx, AV_LOG_ERROR,
1282− "Luma bit depth (%d) is different from chroma bit depth (%d), "
1283− "this is unsupported.\n",
1284− sps->bit_depth, bit_depth_chroma);
1285− return AVERROR_INVALIDDATA;
1286− }
1287− sps->bit_depth_chroma = bit_depth_chroma;
1268+ sps->bit_depth = get_ue_golomb_31(gb) + 8;
1269+ if (sps->bit_depth > 16) {
1270+ av_log(avctx, AV_LOG_ERROR, "Luma bit depth (%d) is out of range\n",
1271+ sps->bit_depth);
1272+ return AVERROR_INVALIDDATA;
1273+ }
1274+ bit_depth_chroma = get_ue_golomb_31(gb) + 8;
1275+ if (bit_depth_chroma > 16) {
1276+ av_log(avctx, AV_LOG_ERROR, "Chroma bit depth (%d) is out of range\n",
1277+ bit_depth_chroma);
1278+ return AVERROR_INVALIDDATA;
1279+ }
1280+ if (sps->chroma_format_idc && bit_depth_chroma != sps->bit_depth) {
1281+ av_log(avctx, AV_LOG_ERROR,
1282+ "Luma bit depth (%d) is different from chroma bit depth (%d), "
1283+ "this is unsupported.\n",
1284+ sps->bit_depth, bit_depth_chroma);
1285+ return AVERROR_INVALIDDATA;
1286+ }
1287+ sps->bit_depth_chroma = bit_depth_chroma;
12881288 }
12891289
12901290 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
13011301 }
13021302
13031303 if (!multi_layer_ext) {
1304− int start;
1305−
1306− sps->sublayer_ordering_info = get_bits1(gb);
1307− start = sps->sublayer_ordering_info ? 0 : sps->max_sub_layers - 1;
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;
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;
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",
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) {
1304+ int start;
1305+
1306+ sps->sublayer_ordering_info = get_bits1(gb);
1307+ start = sps->sublayer_ordering_info ? 0 : sps->max_sub_layers - 1;
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;
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;
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",
1314+ sps->temporal_layer[i].max_dec_pic_buffering - 1U);
13221315 return AVERROR_INVALIDDATA;
13231316 }
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+ }
13251326 }
1326− }
13271327
1328− if (!sps->sublayer_ordering_info) {
1329− for (i = 0; i < start; i++) {
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;
1332− sps->temporal_layer[i].max_latency_increase = sps->temporal_layer[start].max_latency_increase;
1328+ if (!sps->sublayer_ordering_info) {
1329+ for (i = 0; i < start; i++) {
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;
1332+ sps->temporal_layer[i].max_latency_increase = sps->temporal_layer[start].max_latency_increase;
1333+ }
13331334 }
1334− }
13351335 } else {
13361336 for (int i = 0; i < sps->max_sub_layers; i++) {
13371337 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