|
|
@ -826,6 +826,7 @@ static int map_pixel_format(AVCodecContext *avctx, HEVCSPS *sps) |
|
|
|
int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id, |
|
|
|
int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id, |
|
|
|
int apply_defdispwin, AVBufferRef **vps_list, AVCodecContext *avctx) |
|
|
|
int apply_defdispwin, AVBufferRef **vps_list, AVCodecContext *avctx) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
HEVCWindow *ow; |
|
|
|
int ret = 0; |
|
|
|
int ret = 0; |
|
|
|
int log2_diff_max_min_transform_block_size; |
|
|
|
int log2_diff_max_min_transform_block_size; |
|
|
|
int bit_depth_chroma, start, vui_present, sublayer_ordering_info; |
|
|
|
int bit_depth_chroma, start, vui_present, sublayer_ordering_info; |
|
|
@ -1092,30 +1093,21 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id, |
|
|
|
sps->output_window.top_offset += sps->vui.def_disp_win.top_offset; |
|
|
|
sps->output_window.top_offset += sps->vui.def_disp_win.top_offset; |
|
|
|
sps->output_window.bottom_offset += sps->vui.def_disp_win.bottom_offset; |
|
|
|
sps->output_window.bottom_offset += sps->vui.def_disp_win.bottom_offset; |
|
|
|
} |
|
|
|
} |
|
|
|
if (sps->output_window.left_offset & (0x1F >> (sps->pixel_shift)) && |
|
|
|
|
|
|
|
!(avctx->flags & AV_CODEC_FLAG_UNALIGNED)) { |
|
|
|
ow = &sps->output_window; |
|
|
|
sps->output_window.left_offset &= ~(0x1F >> (sps->pixel_shift)); |
|
|
|
if (ow->left_offset >= INT_MAX - ow->right_offset || |
|
|
|
av_log(avctx, AV_LOG_WARNING, "Reducing left output window to %d " |
|
|
|
ow->top_offset >= INT_MAX - ow->bottom_offset || |
|
|
|
"chroma samples to preserve alignment.\n", |
|
|
|
ow->left_offset + ow->right_offset >= sps->width || |
|
|
|
sps->output_window.left_offset); |
|
|
|
ow->top_offset + ow->bottom_offset >= sps->height) { |
|
|
|
} |
|
|
|
av_log(avctx, AV_LOG_WARNING, "Invalid cropping offsets: %u/%u/%u/%u\n", |
|
|
|
sps->output_width = sps->width - |
|
|
|
ow->left_offset, ow->right_offset, ow->top_offset, ow->bottom_offset); |
|
|
|
(sps->output_window.left_offset + sps->output_window.right_offset); |
|
|
|
|
|
|
|
sps->output_height = sps->height - |
|
|
|
|
|
|
|
(sps->output_window.top_offset + sps->output_window.bottom_offset); |
|
|
|
|
|
|
|
if (sps->width <= sps->output_window.left_offset + (int64_t)sps->output_window.right_offset || |
|
|
|
|
|
|
|
sps->height <= sps->output_window.top_offset + (int64_t)sps->output_window.bottom_offset) { |
|
|
|
|
|
|
|
av_log(avctx, AV_LOG_WARNING, "Invalid visible frame dimensions: %dx%d.\n", |
|
|
|
|
|
|
|
sps->output_width, sps->output_height); |
|
|
|
|
|
|
|
if (avctx->err_recognition & AV_EF_EXPLODE) { |
|
|
|
if (avctx->err_recognition & AV_EF_EXPLODE) { |
|
|
|
return AVERROR_INVALIDDATA; |
|
|
|
return AVERROR_INVALIDDATA; |
|
|
|
} |
|
|
|
} |
|
|
|
av_log(avctx, AV_LOG_WARNING, |
|
|
|
av_log(avctx, AV_LOG_WARNING, |
|
|
|
"Displaying the whole video surface.\n"); |
|
|
|
"Displaying the whole video surface.\n"); |
|
|
|
|
|
|
|
memset(ow, 0, sizeof(*ow)); |
|
|
|
memset(&sps->pic_conf_win, 0, sizeof(sps->pic_conf_win)); |
|
|
|
memset(&sps->pic_conf_win, 0, sizeof(sps->pic_conf_win)); |
|
|
|
memset(&sps->output_window, 0, sizeof(sps->output_window)); |
|
|
|
|
|
|
|
sps->output_width = sps->width; |
|
|
|
|
|
|
|
sps->output_height = sps->height; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Inferred parameters
|
|
|
|
// Inferred parameters
|
|
|
@ -1221,7 +1213,8 @@ int ff_hevc_decode_nal_sps(GetBitContext *gb, AVCodecContext *avctx, |
|
|
|
"Parsed SPS: id %d; coded wxh: %dx%d; " |
|
|
|
"Parsed SPS: id %d; coded wxh: %dx%d; " |
|
|
|
"cropped wxh: %dx%d; pix_fmt: %s.\n", |
|
|
|
"cropped wxh: %dx%d; pix_fmt: %s.\n", |
|
|
|
sps_id, sps->width, sps->height, |
|
|
|
sps_id, sps->width, sps->height, |
|
|
|
sps->output_width, sps->output_height, |
|
|
|
sps->width - (sps->output_window.left_offset + sps->output_window.right_offset), |
|
|
|
|
|
|
|
sps->height - (sps->output_window.top_offset + sps->output_window.bottom_offset), |
|
|
|
av_get_pix_fmt_name(sps->pix_fmt)); |
|
|
|
av_get_pix_fmt_name(sps->pix_fmt)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|