1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

Merge commit '064698d381e1e7790f21b0199a8930ea04e2e942'

* commit '064698d381e1e7790f21b0199a8930ea04e2e942':
  Add HEVC decoder

Conflicts:
	Changelog
	libavcodec/Makefile
	libavcodec/allcodecs.c
	libavcodec/hevc.c
	libavcodec/hevc.h
	libavcodec/hevc_cabac.c
	libavcodec/hevc_filter.c
	libavcodec/hevc_mvs.c
	libavcodec/hevc_parser.c
	libavcodec/hevc_ps.c
	libavcodec/hevc_refs.c
	libavcodec/hevc_sei.c
	libavcodec/hevcdsp.c
	libavcodec/hevcdsp_template.c
	libavcodec/hevcpred.c
	libavcodec/hevcpred_template.c
	libavcodec/version.h

cosmetics from hevc.h & hevc_ps.c mostly merged, other files left as they where in ffmpeg.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2013-11-01 16:14:39 +01:00
commit 5eb1704d5f
9 changed files with 225 additions and 198 deletions

View File

@ -609,6 +609,7 @@ following image formats are supported:
@item H.263+ / H.263-1998 / H.263 version 2 @tab X @tab X
@item H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 @tab E @tab X
@tab encoding supported through external library libx264
@item HEVC @tab @tab X
@item HNM version 4 @tab @tab X
@item HuffYUV @tab X @tab X
@item HuffYUV FFmpeg variant @tab X @tab X

View File

@ -277,6 +277,7 @@ enum AVCodecID {
AV_CODEC_ID_G2M_DEPRECATED,
AV_CODEC_ID_WEBP_DEPRECATED,
AV_CODEC_ID_HNM4_VIDEO,
AV_CODEC_ID_HEVC_DEPRECATED,
AV_CODEC_ID_BRENDER_PIX= MKBETAG('B','P','I','X'),
AV_CODEC_ID_Y41P = MKBETAG('Y','4','1','P'),

View File

@ -225,13 +225,6 @@ static const AVCodecDescriptor codec_descriptors[] = {
.long_name = NULL_IF_CONFIG_SMALL("H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"),
.props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_LOSSLESS,
},
{
.id = AV_CODEC_ID_HEVC,
.type = AVMEDIA_TYPE_VIDEO,
.name = "hevc",
.long_name = NULL_IF_CONFIG_SMALL("H.265 / HEVC"),
.props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_LOSSLESS,
},
{
.id = AV_CODEC_ID_INDEO3,
.type = AVMEDIA_TYPE_VIDEO,
@ -1401,6 +1394,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
.long_name = NULL_IF_CONFIG_SMALL("HNM 4 video"),
.props = AV_CODEC_PROP_LOSSY,
},
{
.id = AV_CODEC_ID_HEVC,
.type = AVMEDIA_TYPE_VIDEO,
.name = "hevc",
.long_name = NULL_IF_CONFIG_SMALL("H.265 / HEVC (High Efficiency Video Coding)"),
.props = AV_CODEC_PROP_LOSSY,
},
/* various PCM "codecs" */
{

View File

@ -2882,7 +2882,7 @@ static void hevc_decode_flush(AVCodecContext *avctx)
#define OFFSET(x) offsetof(HEVCContext, x)
#define PAR (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM)
static const AVOption options[] = {
{ "strict-displaywin", "stricly apply default display window size", OFFSET(strict_def_disp_win),
{ "strict-displaywin", "stricly apply default display window size", OFFSET(apply_defdispwin),
AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, PAR },
{ NULL },
};

View File

@ -1,5 +1,5 @@
/*
* HEVC video Decoder
* HEVC video decoder
*
* Copyright (C) 2012 - 2013 Guillaume Martres
*
@ -347,7 +347,7 @@ typedef struct PTL {
int sub_layer_level_idc[MAX_SUB_LAYERS];
} PTL;
typedef struct VPS {
typedef struct HEVCVPS {
uint8_t vps_temporal_id_nesting_flag;
int vps_max_layers;
int vps_max_sub_layers; ///< vps_max_temporal_layers_minus1 + 1
@ -365,10 +365,11 @@ typedef struct VPS {
uint8_t vps_poc_proportional_to_timing_flag;
int vps_num_ticks_poc_diff_one; ///< vps_num_ticks_poc_diff_one_minus1 + 1
int vps_num_hrd_parameters;
} VPS;
} HEVCVPS;
typedef struct ScalingList {
// This is a little wasteful, since sizeID 0 only needs 8 coeffs, and size ID 3 only has 2 arrays, not 6.
/* This is a little wasteful, since sizeID 0 only needs 8 coeffs,
* and size ID 3 only has 2 arrays, not 6. */
uint8_t sl[4][6][64];
uint8_t sl_dc[2][6];
} ScalingList;
@ -496,7 +497,7 @@ typedef struct HEVCPPS {
int beta_offset; ///< beta_offset_div2 * 2
int tc_offset; ///< tc_offset_div2 * 2
int pps_scaling_list_data_present_flag;
int scaling_list_data_present_flag;
ScalingList scaling_list;
uint8_t lists_modification_present_flag;
@ -778,10 +779,10 @@ typedef struct HEVCContext {
AVFrame *sao_frame;
AVFrame *tmp_frame;
AVFrame *output_frame;
VPS *vps;
HEVCVPS *vps;
const HEVCSPS *sps;
HEVCPPS *pps;
VPS *vps_list[MAX_VPS_COUNT];
HEVCVPS *vps_list[MAX_VPS_COUNT];
AVBufferRef *sps_list[MAX_SPS_COUNT];
AVBufferRef *pps_list[MAX_PPS_COUNT];
@ -825,7 +826,6 @@ typedef struct HEVCContext {
// PU
uint8_t *tab_ipm;
uint8_t *cbf_luma; // cbf_luma of colocated TU
uint8_t *is_pcm;
@ -867,7 +867,7 @@ typedef struct HEVCContext {
int context_initialized;
int is_nalff; ///< this flag is != 0 if bitstream is encapsulated
///< as a format defined in 14496-15
int strict_def_disp_win;
int apply_defdispwin;
int active_seq_parameter_set_id;
@ -902,7 +902,8 @@ void ff_hevc_flush_dpb(HEVCContext *s);
*/
int ff_hevc_compute_poc(HEVCContext *s, int poc_lsb);
RefPicList* ff_hevc_get_ref_list(HEVCContext *s, HEVCFrame *frame, int x0, int y0);
RefPicList *ff_hevc_get_ref_list(HEVCContext *s, HEVCFrame *frame,
int x0, int y0);
/**
* Construct the reference picture sets for the current frame.
@ -924,9 +925,11 @@ int ff_hevc_sao_offset_sign_decode(HEVCContext *s);
int ff_hevc_sao_eo_class_decode(HEVCContext *s);
int ff_hevc_end_of_slice_flag_decode(HEVCContext *s);
int ff_hevc_cu_transquant_bypass_flag_decode(HEVCContext *s);
int ff_hevc_skip_flag_decode(HEVCContext *s, int x0, int y0, int x_cb, int y_cb);
int ff_hevc_skip_flag_decode(HEVCContext *s, int x0, int y0,
int x_cb, int y_cb);
int ff_hevc_pred_mode_decode(HEVCContext *s);
int ff_hevc_split_coding_unit_flag_decode(HEVCContext *s, int ct_depth, int x0, int y0);
int ff_hevc_split_coding_unit_flag_decode(HEVCContext *s, int ct_depth,
int x0, int y0);
int ff_hevc_part_mode_decode(HEVCContext *s, int log2_cb_size);
int ff_hevc_pcm_flag_decode(HEVCContext *s);
int ff_hevc_prev_intra_luma_pred_flag_decode(HEVCContext *s);
@ -959,12 +962,21 @@ int ff_hevc_output_frame(HEVCContext *s, AVFrame *frame, int flush);
void ff_hevc_unref_frame(HEVCContext *s, HEVCFrame *frame, int flags);
void ff_hevc_set_neighbour_available(HEVCContext *s, int x0, int y0, int nPbW, int nPbH);
void ff_hevc_luma_mv_merge_mode(HEVCContext *s, int x0, int y0, int nPbW, int nPbH, int log2_cb_size, int part_idx, int merge_idx, MvField *mv);
void ff_hevc_luma_mv_mvp_mode(HEVCContext *s, int x0, int y0, int nPbW, int nPbH, int log2_cb_size, int part_idx, int merge_idx, MvField *mv , int mvp_lx_flag, int LX);
void ff_hevc_set_qPy(HEVCContext *s, int xC, int yC, int xBase, int yBase, int log2_cb_size);
void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, int log2_trafo_size,
int slice_or_tiles_up_boundary, int slice_or_tiles_left_boundary);
void ff_hevc_set_neighbour_available(HEVCContext *s, int x0, int y0,
int nPbW, int nPbH);
void ff_hevc_luma_mv_merge_mode(HEVCContext *s, int x0, int y0,
int nPbW, int nPbH, int log2_cb_size,
int part_idx, int merge_idx, MvField *mv);
void ff_hevc_luma_mv_mvp_mode(HEVCContext *s, int x0, int y0,
int nPbW, int nPbH, int log2_cb_size,
int part_idx, int merge_idx,
MvField *mv, int mvp_lx_flag, int LX);
void ff_hevc_set_qPy(HEVCContext *s, int xC, int yC, int xBase, int yBase,
int log2_cb_size);
void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0,
int log2_trafo_size,
int slice_or_tiles_up_boundary,
int slice_or_tiles_left_boundary);
int ff_hevc_cu_qp_delta_sign_flag(HEVCContext *s);
int ff_hevc_cu_qp_delta_abs(HEVCContext *s);
void ff_hevc_hls_filter(HEVCContext *s, int x, int y);
@ -986,4 +998,4 @@ extern const uint8_t ff_hevc_diag_scan4x4_y[16];
extern const uint8_t ff_hevc_diag_scan8x8_x[64];
extern const uint8_t ff_hevc_diag_scan8x8_y[64];
#endif // AVCODEC_HEVC_H
#endif /* AVCODEC_HEVC_H */

View File

@ -1137,7 +1137,7 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0,
dc_scale = 16;
if (s->sps->scaling_list_enable_flag) {
const ScalingList *sl = s->pps->pps_scaling_list_data_present_flag ?
const ScalingList *sl = s->pps->scaling_list_data_present_flag ?
&s->pps->scaling_list : &s->sps->scaling_list;
int matrix_id = lc->cu.pred_mode != MODE_INTRA;

View File

@ -1,5 +1,5 @@
/*
* HEVC Parameter Set Decoding
* HEVC Parameter Set decoding
*
* Copyright (C) 2012 - 2103 Guillaume Martres
* Copyright (C) 2012 - 2103 Mickael Raulet
@ -23,8 +23,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "golomb.h"
#include "libavutil/imgutils.h"
#include "golomb.h"
#include "hevc.h"
static const uint8_t default_scaling_list_intra[] = {
@ -35,7 +36,7 @@ static const uint8_t default_scaling_list_intra[] = {
17, 17, 20, 24, 30, 35, 41, 47,
18, 19, 22, 27, 35, 44, 54, 65,
21, 22, 25, 31, 41, 54, 70, 88,
24, 25, 29,36, 47, 65, 88, 115
24, 25, 29, 36, 47, 65, 88, 115
};
static const uint8_t default_scaling_list_inter[] = {
@ -94,9 +95,9 @@ int ff_hevc_decode_short_term_rps(HEVCContext *s, ShortTermRPS *rps,
if (is_slice_header) {
int delta_idx = get_ue_golomb_long(gb) + 1;
if (delta_idx > sps->nb_st_rps) {
av_log(s->avctx, AV_LOG_ERROR, "Invalid value of delta_idx "
"in slice header RPS: %d > %d.\n", delta_idx,
sps->nb_st_rps);
av_log(s->avctx, AV_LOG_ERROR,
"Invalid value of delta_idx in slice header RPS: %d > %d.\n",
delta_idx, sps->nb_st_rps);
return AVERROR_INVALIDDATA;
}
rps_ridx = &sps->st_rps[sps->nb_st_rps - delta_idx];
@ -134,11 +135,11 @@ int ff_hevc_decode_short_term_rps(HEVCContext *s, ShortTermRPS *rps,
for (i = 1; i < rps->num_delta_pocs; i++) {
delta_poc = rps->delta_poc[i];
used = rps->used[i];
for (k = i-1 ; k >= 0; k--) {
for (k = i - 1; k >= 0; k--) {
tmp = rps->delta_poc[k];
if (delta_poc < tmp ) {
rps->delta_poc[k+1] = tmp;
rps->used[k+1] = rps->used[k];
if (delta_poc < tmp) {
rps->delta_poc[k + 1] = tmp;
rps->used[k + 1] = rps->used[k];
rps->delta_poc[k] = delta_poc;
rps->used[k] = used;
}
@ -149,7 +150,7 @@ int ff_hevc_decode_short_term_rps(HEVCContext *s, ShortTermRPS *rps,
int used;
k = rps->num_negative_pics - 1;
// flip the negative values to largest first
for (i = 0; i < rps->num_negative_pics>>1; i++) {
for (i = 0; i < rps->num_negative_pics >> 1; i++) {
delta_poc = rps->delta_poc[i];
used = rps->used[i];
rps->delta_poc[i] = rps->delta_poc[k];
@ -191,11 +192,12 @@ int ff_hevc_decode_short_term_rps(HEVCContext *s, ShortTermRPS *rps,
return 0;
}
static int decode_profile_tier_level(HEVCContext *s, PTL *ptl, int max_num_sub_layers)
static int decode_profile_tier_level(HEVCContext *s, PTL *ptl,
int max_num_sub_layers)
{
int i, j;
HEVCLocalContext *lc = s->HEVClc;
GetBitContext *gb = &lc->gb;
int i, j;
ptl->general_profile_space = get_bits(gb, 2);
ptl->general_tier_flag = get_bits1(gb);
@ -209,10 +211,10 @@ static int decode_profile_tier_level(HEVCContext *s, PTL *ptl, int max_num_sub_l
for (i = 0; i < 32; i++)
ptl->general_profile_compatibility_flag[i] = get_bits1(gb);
skip_bits1(gb);// general_progressive_source_flag
skip_bits1(gb);// general_interlaced_source_flag
skip_bits1(gb);// general_non_packed_constraint_flag
skip_bits1(gb);// general_frame_only_constraint_flag
skip_bits1(gb); // general_progressive_source_flag
skip_bits1(gb); // general_interlaced_source_flag
skip_bits1(gb); // general_non_packed_constraint_flag
skip_bits1(gb); // general_frame_only_constraint_flag
if (get_bits(gb, 16) != 0) // XXX_reserved_zero_44bits[0..15]
return -1;
if (get_bits(gb, 16) != 0) // XXX_reserved_zero_44bits[16..31]
@ -235,10 +237,10 @@ static int decode_profile_tier_level(HEVCContext *s, PTL *ptl, int max_num_sub_l
ptl->sub_layer_profile_idc[i] = get_bits(gb, 5);
for (j = 0; j < 32; j++)
ptl->sub_layer_profile_compatibility_flags[i][j] = get_bits1(gb);
skip_bits1(gb);// sub_layer_progressive_source_flag
skip_bits1(gb);// sub_layer_interlaced_source_flag
skip_bits1(gb);// sub_layer_non_packed_constraint_flag
skip_bits1(gb);// sub_layer_frame_only_constraint_flag
skip_bits1(gb); // sub_layer_progressive_source_flag
skip_bits1(gb); // sub_layer_interlaced_source_flag
skip_bits1(gb); // sub_layer_non_packed_constraint_flag
skip_bits1(gb); // sub_layer_frame_only_constraint_flag
if (get_bits(gb, 16) != 0) // sub_layer_reserved_zero_44bits[0..15]
return -1;
@ -253,7 +255,8 @@ static int decode_profile_tier_level(HEVCContext *s, PTL *ptl, int max_num_sub_l
return 0;
}
static void decode_sublayer_hrd(HEVCContext *s, int nb_cpb, int subpic_params_present)
static void decode_sublayer_hrd(HEVCContext *s, int nb_cpb,
int subpic_params_present)
{
GetBitContext *gb = &s->HEVClc->gb;
int i;
@ -331,7 +334,7 @@ int ff_hevc_decode_nal_vps(HEVCContext *s)
int i,j;
GetBitContext *gb = &s->HEVClc->gb;
int vps_id = 0;
VPS *vps;
HEVCVPS *vps;
av_log(s->avctx, AV_LOG_DEBUG, "Decoding VPS\n");
@ -440,8 +443,8 @@ static void decode_vui(HEVCContext *s, HEVCSPS *sps)
vui->sar.num = get_bits(gb, 16);
vui->sar.den = get_bits(gb, 16);
} else
av_log(s->avctx, AV_LOG_WARNING, "Unknown SAR index: %u.\n",
sar_idx);
av_log(s->avctx, AV_LOG_WARNING,
"Unknown SAR index: %u.\n", sar_idx);
}
vui->overscan_info_present_flag = get_bits1(gb);
@ -478,7 +481,7 @@ static void decode_vui(HEVCContext *s, HEVCSPS *sps)
vui->def_disp_win.top_offset = get_ue_golomb_long(gb) * 2;
vui->def_disp_win.bottom_offset = get_ue_golomb_long(gb) * 2;
if (s->strict_def_disp_win &&
if (s->apply_defdispwin &&
s->avctx->flags2 & CODEC_FLAG2_IGNORE_CROP) {
av_log(s->avctx, AV_LOG_DEBUG,
"discarding vui default display window, "
@ -551,14 +554,15 @@ static int scaling_list_data(HEVCContext *s, ScalingList *sl)
GetBitContext *gb = &s->HEVClc->gb;
uint8_t scaling_list_pred_mode_flag[4][6];
int32_t scaling_list_dc_coef[2][6];
int size_id, matrix_id, i, pos, delta;
for (size_id = 0; size_id < 4; size_id++)
for (matrix_id = 0; matrix_id < ((size_id == 3) ? 2 : 6); matrix_id++) {
for (matrix_id = 0; matrix_id < (size_id == 3 ? 2 : 6); matrix_id++) {
scaling_list_pred_mode_flag[size_id][matrix_id] = get_bits1(gb);
if (!scaling_list_pred_mode_flag[size_id][matrix_id]) {
delta = get_ue_golomb_long(gb);
// Only need to handle non-zero delta. Zero means default, which should already be in the arrays.
/* Only need to handle non-zero delta. Zero means default,
* which should already be in the arrays. */
if (delta) {
// Copy from previous array.
if (matrix_id - delta < 0) {
@ -574,12 +578,11 @@ static int scaling_list_data(HEVCContext *s, ScalingList *sl)
sl->sl_dc[size_id - 2][matrix_id] = sl->sl_dc[size_id - 2][matrix_id - delta];
}
} else {
int next_coef;
int coef_num;
int next_coef, coef_num;
int32_t scaling_list_delta_coef;
next_coef = 8;
coef_num = FFMIN(64, (1 << (4 + (size_id << 1))));
coef_num = FFMIN(64, 1 << (4 + (size_id << 1)));
if (size_id > 1) {
scaling_list_dc_coef[size_id - 2][matrix_id] = get_se_golomb(gb) + 8;
next_coef = scaling_list_dc_coef[size_id - 2][matrix_id];
@ -587,12 +590,14 @@ static int scaling_list_data(HEVCContext *s, ScalingList *sl)
}
for (i = 0; i < coef_num; i++) {
if (size_id == 0)
pos = 4 * ff_hevc_diag_scan4x4_y[i] + ff_hevc_diag_scan4x4_x[i];
pos = 4 * ff_hevc_diag_scan4x4_y[i] +
ff_hevc_diag_scan4x4_x[i];
else
pos = 8 * ff_hevc_diag_scan8x8_y[i] + ff_hevc_diag_scan8x8_x[i];
pos = 8 * ff_hevc_diag_scan8x8_y[i] +
ff_hevc_diag_scan8x8_x[i];
scaling_list_delta_coef = get_se_golomb(gb);
next_coef = (next_coef + scaling_list_delta_coef + 256 ) % 256;
next_coef = (next_coef + scaling_list_delta_coef + 256) % 256;
sl->sl[size_id][matrix_id][pos] = next_coef;
}
}
@ -653,7 +658,7 @@ int ff_hevc_decode_nal_sps(HEVCContext *s)
sps->chroma_format_idc = get_ue_golomb_long(gb);
if (sps->chroma_format_idc != 1) {
avpriv_report_missing_feature(s->avctx, "chroma_format_idc != 1\n");
ret = AVERROR_INVALIDDATA;
ret = AVERROR_PATCHWELCOME;
goto err;
}
@ -694,7 +699,8 @@ int ff_hevc_decode_nal_sps(HEVCContext *s)
bit_depth_chroma = get_ue_golomb_long(gb) + 8;
if (bit_depth_chroma != sps->bit_depth) {
av_log(s->avctx, AV_LOG_ERROR,
"Luma bit depth (%d) is different from chroma bit depth (%d), this is unsupported.\n",
"Luma bit depth (%d) is different from chroma bit depth (%d), "
"this is unsupported.\n",
sps->bit_depth, bit_depth_chroma);
ret = AVERROR_INVALIDDATA;
goto err;
@ -712,7 +718,8 @@ int ff_hevc_decode_nal_sps(HEVCContext *s)
goto err;
}
} else {
av_log(s->avctx, AV_LOG_ERROR, "non-4:2:0 support is currently unspecified.\n");
av_log(s->avctx, AV_LOG_ERROR,
"non-4:2:0 support is currently unspecified.\n");
return AVERROR_PATCHWELCOME;
}
@ -757,7 +764,7 @@ int ff_hevc_decode_nal_sps(HEVCContext *s)
}
if (!sublayer_ordering_info) {
for (i = 0; i < start; i++){
for (i = 0; i < start; i++) {
sps->temporal_layer[i].max_dec_pic_buffering = sps->temporal_layer[start].max_dec_pic_buffering;
sps->temporal_layer[i].num_reorder_pics = sps->temporal_layer[start].num_reorder_pics;
sps->temporal_layer[i].max_latency_increase = sps->temporal_layer[start].max_latency_increase;
@ -768,7 +775,8 @@ int ff_hevc_decode_nal_sps(HEVCContext *s)
sps->log2_diff_max_min_coding_block_size = get_ue_golomb_long(gb);
sps->log2_min_tb_size = get_ue_golomb_long(gb) + 2;
log2_diff_max_min_transform_block_size = get_ue_golomb_long(gb);
sps->log2_max_trafo_size = log2_diff_max_min_transform_block_size + sps->log2_min_tb_size;
sps->log2_max_trafo_size = log2_diff_max_min_transform_block_size +
sps->log2_min_tb_size;
if (sps->log2_min_tb_size >= sps->log2_min_cb_size) {
av_log(s->avctx, AV_LOG_ERROR, "Invalid value for log2_min_tb_size");
@ -840,7 +848,7 @@ int ff_hevc_decode_nal_sps(HEVCContext *s)
decode_vui(s, sps);
skip_bits1(gb); // sps_extension_flag
if (s->strict_def_disp_win) {
if (s->apply_defdispwin) {
sps->output_window.left_offset += sps->vui.def_disp_win.left_offset;
sps->output_window.right_offset += sps->vui.def_disp_win.right_offset;
sps->output_window.top_offset += sps->vui.def_disp_win.top_offset;
@ -864,7 +872,8 @@ int ff_hevc_decode_nal_sps(HEVCContext *s)
ret = AVERROR_INVALIDDATA;
goto err;
}
av_log(s->avctx, AV_LOG_WARNING, "Displaying the whole video surface.\n");
av_log(s->avctx, AV_LOG_WARNING,
"Displaying the whole video surface.\n");
sps->pic_conf_win.left_offset =
sps->pic_conf_win.right_offset =
sps->pic_conf_win.top_offset =
@ -874,8 +883,8 @@ int ff_hevc_decode_nal_sps(HEVCContext *s)
}
// Inferred parameters
sps->log2_ctb_size = sps->log2_min_cb_size
+ sps->log2_diff_max_min_coding_block_size;
sps->log2_ctb_size = sps->log2_min_cb_size +
sps->log2_diff_max_min_coding_block_size;
sps->log2_min_pu_size = sps->log2_min_cb_size - 1;
sps->ctb_width = (sps->width + (1 << sps->log2_ctb_size) - 1) >> sps->log2_ctb_size;
@ -912,13 +921,15 @@ int ff_hevc_decode_nal_sps(HEVCContext *s)
goto err;
}
if (sps->log2_max_trafo_size > FFMIN(sps->log2_ctb_size, 5)) {
av_log(s->avctx, AV_LOG_ERROR, "max transform block size out of range: %d\n",
av_log(s->avctx, AV_LOG_ERROR,
"max transform block size out of range: %d\n",
sps->log2_max_trafo_size);
goto err;
}
if (s->avctx->debug & FF_DEBUG_BITSTREAM) {
av_log(s->avctx, AV_LOG_DEBUG, "Parsed SPS: id %d; coded wxh: %dx%d; "
av_log(s->avctx, AV_LOG_DEBUG,
"Parsed SPS: id %d; coded wxh: %dx%d; "
"cropped wxh: %dx%d; pix_fmt: %s.\n",
sps_id, sps->width, sps->height,
sps->output_width, sps->output_height,
@ -941,8 +952,8 @@ int ff_hevc_decode_nal_sps(HEVCContext *s)
}
return 0;
err:
err:
av_buffer_unref(&sps_buf);
return ret;
}
@ -982,7 +993,8 @@ int ff_hevc_decode_nal_pps(HEVCContext *s)
if (!pps)
return AVERROR(ENOMEM);
pps_buf = av_buffer_create((uint8_t*)pps, sizeof(*pps), hevc_pps_free, NULL, 0);
pps_buf = av_buffer_create((uint8_t *)pps, sizeof(*pps),
hevc_pps_free, NULL, 0);
if (!pps_buf) {
av_freep(&pps);
return AVERROR(ENOMEM);
@ -1017,7 +1029,7 @@ int ff_hevc_decode_nal_pps(HEVCContext *s)
ret = AVERROR_INVALIDDATA;
goto err;
}
sps = (HEVCSPS*)s->sps_list[pps->sps_id]->data;
sps = (HEVCSPS *)s->sps_list[pps->sps_id]->data;
pps->dependent_slice_segments_enabled_flag = get_bits1(gb);
pps->output_flag_present_flag = get_bits1(gb);
@ -1141,8 +1153,8 @@ int ff_hevc_decode_nal_pps(HEVCContext *s)
}
}
pps->pps_scaling_list_data_present_flag = get_bits1(gb);
if (pps->pps_scaling_list_data_present_flag) {
pps->scaling_list_data_present_flag = get_bits1(gb);
if (pps->scaling_list_data_present_flag) {
set_default_scaling_list_data(&pps->scaling_list);
ret = scaling_list_data(s, &pps->scaling_list);
if (ret < 0)
@ -1243,9 +1255,9 @@ int ff_hevc_decode_nal_pps(HEVCContext *s)
}
}
for (i = 0; i < tile_x; i++ )
for (i = 0; i < tile_x; i++)
val += pps->row_height[tile_y] * pps->column_width[i];
for (i = 0; i < tile_y; i++ )
for (i = 0; i < tile_y; i++)
val += sps->ctb_width * pps->row_height[i];
val += (tb_y - pps->row_bd[tile_y]) * pps->column_width[tile_x] +

View File

@ -2606,6 +2606,7 @@ static enum AVCodecID remap_deprecated_codec_id(enum AVCodecID id)
case AV_CODEC_ID_ESCAPE130_DEPRECATED : return AV_CODEC_ID_ESCAPE130;
case AV_CODEC_ID_G2M_DEPRECATED : return AV_CODEC_ID_G2M;
case AV_CODEC_ID_WEBP_DEPRECATED: return AV_CODEC_ID_WEBP;
case AV_CODEC_ID_HEVC_DEPRECATED: return AV_CODEC_ID_HEVC;
default : return id;
}
}

View File

@ -30,7 +30,7 @@
#define LIBAVCODEC_VERSION_MAJOR 55
#define LIBAVCODEC_VERSION_MINOR 40
#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_MICRO 101
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \