Commit 5eb1704d authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '064698d3'

* commit '064698d3':
  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: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents c617c669 064698d3
...@@ -609,6 +609,7 @@ following image formats are supported: ...@@ -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.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 @item H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 @tab E @tab X
@tab encoding supported through external library libx264 @tab encoding supported through external library libx264
@item HEVC @tab @tab X
@item HNM version 4 @tab @tab X @item HNM version 4 @tab @tab X
@item HuffYUV @tab X @tab X @item HuffYUV @tab X @tab X
@item HuffYUV FFmpeg variant @tab X @tab X @item HuffYUV FFmpeg variant @tab X @tab X
......
...@@ -277,6 +277,7 @@ enum AVCodecID { ...@@ -277,6 +277,7 @@ enum AVCodecID {
AV_CODEC_ID_G2M_DEPRECATED, AV_CODEC_ID_G2M_DEPRECATED,
AV_CODEC_ID_WEBP_DEPRECATED, AV_CODEC_ID_WEBP_DEPRECATED,
AV_CODEC_ID_HNM4_VIDEO, AV_CODEC_ID_HNM4_VIDEO,
AV_CODEC_ID_HEVC_DEPRECATED,
AV_CODEC_ID_BRENDER_PIX= MKBETAG('B','P','I','X'), AV_CODEC_ID_BRENDER_PIX= MKBETAG('B','P','I','X'),
AV_CODEC_ID_Y41P = MKBETAG('Y','4','1','P'), AV_CODEC_ID_Y41P = MKBETAG('Y','4','1','P'),
......
...@@ -225,13 +225,6 @@ static const AVCodecDescriptor codec_descriptors[] = { ...@@ -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"), .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, .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, .id = AV_CODEC_ID_INDEO3,
.type = AVMEDIA_TYPE_VIDEO, .type = AVMEDIA_TYPE_VIDEO,
...@@ -1401,6 +1394,13 @@ static const AVCodecDescriptor codec_descriptors[] = { ...@@ -1401,6 +1394,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
.long_name = NULL_IF_CONFIG_SMALL("HNM 4 video"), .long_name = NULL_IF_CONFIG_SMALL("HNM 4 video"),
.props = AV_CODEC_PROP_LOSSY, .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" */ /* various PCM "codecs" */
{ {
......
...@@ -2882,7 +2882,7 @@ static void hevc_decode_flush(AVCodecContext *avctx) ...@@ -2882,7 +2882,7 @@ static void hevc_decode_flush(AVCodecContext *avctx)
#define OFFSET(x) offsetof(HEVCContext, x) #define OFFSET(x) offsetof(HEVCContext, x)
#define PAR (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM) #define PAR (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM)
static const AVOption options[] = { 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 }, AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, PAR },
{ NULL }, { NULL },
}; };
......
/* /*
* HEVC video Decoder * HEVC video decoder
* *
* Copyright (C) 2012 - 2013 Guillaume Martres * Copyright (C) 2012 - 2013 Guillaume Martres
* *
...@@ -347,7 +347,7 @@ typedef struct PTL { ...@@ -347,7 +347,7 @@ typedef struct PTL {
int sub_layer_level_idc[MAX_SUB_LAYERS]; int sub_layer_level_idc[MAX_SUB_LAYERS];
} PTL; } PTL;
typedef struct VPS { typedef struct HEVCVPS {
uint8_t vps_temporal_id_nesting_flag; uint8_t vps_temporal_id_nesting_flag;
int vps_max_layers; int vps_max_layers;
int vps_max_sub_layers; ///< vps_max_temporal_layers_minus1 + 1 int vps_max_sub_layers; ///< vps_max_temporal_layers_minus1 + 1
...@@ -365,10 +365,11 @@ typedef struct VPS { ...@@ -365,10 +365,11 @@ typedef struct VPS {
uint8_t vps_poc_proportional_to_timing_flag; 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_ticks_poc_diff_one; ///< vps_num_ticks_poc_diff_one_minus1 + 1
int vps_num_hrd_parameters; int vps_num_hrd_parameters;
} VPS; } HEVCVPS;
typedef struct ScalingList { 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[4][6][64];
uint8_t sl_dc[2][6]; uint8_t sl_dc[2][6];
} ScalingList; } ScalingList;
...@@ -496,7 +497,7 @@ typedef struct HEVCPPS { ...@@ -496,7 +497,7 @@ typedef struct HEVCPPS {
int beta_offset; ///< beta_offset_div2 * 2 int beta_offset; ///< beta_offset_div2 * 2
int tc_offset; ///< tc_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; ScalingList scaling_list;
uint8_t lists_modification_present_flag; uint8_t lists_modification_present_flag;
...@@ -778,10 +779,10 @@ typedef struct HEVCContext { ...@@ -778,10 +779,10 @@ typedef struct HEVCContext {
AVFrame *sao_frame; AVFrame *sao_frame;
AVFrame *tmp_frame; AVFrame *tmp_frame;
AVFrame *output_frame; AVFrame *output_frame;
VPS *vps; HEVCVPS *vps;
const HEVCSPS *sps; const HEVCSPS *sps;
HEVCPPS *pps; HEVCPPS *pps;
VPS *vps_list[MAX_VPS_COUNT]; HEVCVPS *vps_list[MAX_VPS_COUNT];
AVBufferRef *sps_list[MAX_SPS_COUNT]; AVBufferRef *sps_list[MAX_SPS_COUNT];
AVBufferRef *pps_list[MAX_PPS_COUNT]; AVBufferRef *pps_list[MAX_PPS_COUNT];
...@@ -825,7 +826,6 @@ typedef struct HEVCContext { ...@@ -825,7 +826,6 @@ typedef struct HEVCContext {
// PU // PU
uint8_t *tab_ipm; uint8_t *tab_ipm;
uint8_t *cbf_luma; // cbf_luma of colocated TU uint8_t *cbf_luma; // cbf_luma of colocated TU
uint8_t *is_pcm; uint8_t *is_pcm;
...@@ -867,7 +867,7 @@ typedef struct HEVCContext { ...@@ -867,7 +867,7 @@ typedef struct HEVCContext {
int context_initialized; int context_initialized;
int is_nalff; ///< this flag is != 0 if bitstream is encapsulated int is_nalff; ///< this flag is != 0 if bitstream is encapsulated
///< as a format defined in 14496-15 ///< as a format defined in 14496-15
int strict_def_disp_win; int apply_defdispwin;
int active_seq_parameter_set_id; int active_seq_parameter_set_id;
...@@ -902,7 +902,8 @@ void ff_hevc_flush_dpb(HEVCContext *s); ...@@ -902,7 +902,8 @@ void ff_hevc_flush_dpb(HEVCContext *s);
*/ */
int ff_hevc_compute_poc(HEVCContext *s, int poc_lsb); 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. * Construct the reference picture sets for the current frame.
...@@ -924,9 +925,11 @@ int ff_hevc_sao_offset_sign_decode(HEVCContext *s); ...@@ -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_sao_eo_class_decode(HEVCContext *s);
int ff_hevc_end_of_slice_flag_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_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_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_part_mode_decode(HEVCContext *s, int log2_cb_size);
int ff_hevc_pcm_flag_decode(HEVCContext *s); int ff_hevc_pcm_flag_decode(HEVCContext *s);
int ff_hevc_prev_intra_luma_pred_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); ...@@ -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_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_set_neighbour_available(HEVCContext *s, int x0, int y0,
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); int nPbW, int nPbH);
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_luma_mv_merge_mode(HEVCContext *s, int x0, int y0,
void ff_hevc_set_qPy(HEVCContext *s, int xC, int yC, int xBase, int yBase, int log2_cb_size); int nPbW, int nPbH, int log2_cb_size,
void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, int log2_trafo_size, int part_idx, int merge_idx, MvField *mv);
int slice_or_tiles_up_boundary, int slice_or_tiles_left_boundary); 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_sign_flag(HEVCContext *s);
int ff_hevc_cu_qp_delta_abs(HEVCContext *s); int ff_hevc_cu_qp_delta_abs(HEVCContext *s);
void ff_hevc_hls_filter(HEVCContext *s, int x, int y); 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]; ...@@ -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_x[64];
extern const uint8_t ff_hevc_diag_scan8x8_y[64]; extern const uint8_t ff_hevc_diag_scan8x8_y[64];
#endif // AVCODEC_HEVC_H #endif /* AVCODEC_HEVC_H */
...@@ -1137,7 +1137,7 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, ...@@ -1137,7 +1137,7 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0,
dc_scale = 16; dc_scale = 16;
if (s->sps->scaling_list_enable_flag) { 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; &s->pps->scaling_list : &s->sps->scaling_list;
int matrix_id = lc->cu.pred_mode != MODE_INTRA; int matrix_id = lc->cu.pred_mode != MODE_INTRA;
......
This diff is collapsed.
...@@ -2606,6 +2606,7 @@ static enum AVCodecID remap_deprecated_codec_id(enum AVCodecID id) ...@@ -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_ESCAPE130_DEPRECATED : return AV_CODEC_ID_ESCAPE130;
case AV_CODEC_ID_G2M_DEPRECATED : return AV_CODEC_ID_G2M; 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_WEBP_DEPRECATED: return AV_CODEC_ID_WEBP;
case AV_CODEC_ID_HEVC_DEPRECATED: return AV_CODEC_ID_HEVC;
default : return id; default : return id;
} }
} }
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#define LIBAVCODEC_VERSION_MAJOR 55 #define LIBAVCODEC_VERSION_MAJOR 55
#define LIBAVCODEC_VERSION_MINOR 40 #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, \ #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \ LIBAVCODEC_VERSION_MINOR, \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment