diff options
Diffstat (limited to 'libavcodec/hevc.h')
-rw-r--r-- | libavcodec/hevc.h | 101 |
1 files changed, 48 insertions, 53 deletions
diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h index 1197d08193..4a6620f67b 100644 --- a/libavcodec/hevc.h +++ b/libavcodec/hevc.h @@ -3,29 +3,26 @@ * * Copyright (C) 2012 - 2013 Guillaume Martres * - * This file is part of Libav. + * This file is part of FFmpeg. * - * Libav is free software; you can redistribute it and/or + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * - * Libav is distributed in the hope that it will be useful, + * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with Libav; if not, write to the Free Software + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef AVCODEC_HEVC_H #define AVCODEC_HEVC_H -#include <stddef.h> -#include <stdint.h> - #include "libavutil/buffer.h" #include "libavutil/md5.h" @@ -33,6 +30,7 @@ #include "cabac.h" #include "dsputil.h" #include "get_bits.h" +#include "hevcpred.h" #include "hevcdsp.h" #include "internal.h" #include "thread.h" @@ -41,6 +39,9 @@ #define MAX_DPB_SIZE 16 // A.4.1 #define MAX_REFS 16 +#define MAX_NB_THREADS 16 +#define SHIFT_CTB_WPP 2 + /** * 7.4.2.1 */ @@ -85,9 +86,6 @@ s->nal_unit_type == NAL_BLA_N_LP) #define IS_IRAP(s) (s->nal_unit_type >= 16 && s->nal_unit_type <= 23) -#define FFUDIV(a,b) (((a) > 0 ? (a) : (a) - (b) + 1) / (b)) -#define FFUMOD(a,b) ((a) - (b) * FFUDIV(a,b)) - /** * Table 7-3: NAL unit type codes */ @@ -382,7 +380,7 @@ typedef struct ScalingList { } ScalingList; typedef struct HEVCSPS { - int vps_id; + unsigned vps_id; int chroma_format_idc; uint8_t separate_colour_plane_flag; @@ -575,6 +573,9 @@ typedef struct SliceHeader { unsigned int max_num_merge_cand; ///< 5 - 5_minus_max_num_merge_cand + int *entry_point_offset; + int * offset; + int * size; int num_entry_point_offsets; int8_t slice_qp; @@ -709,21 +710,6 @@ typedef struct HEVCNAL { const uint8_t *data; } HEVCNAL; -struct HEVCContext; - -typedef struct HEVCPredContext { - void (*intra_pred)(struct HEVCContext *s, int x0, int y0, - int log2_size, int c_idx); - - void (*pred_planar[4])(uint8_t *src, const uint8_t *top, - const uint8_t *left, ptrdiff_t stride); - void (*pred_dc)(uint8_t *src, const uint8_t *top, const uint8_t *left, - ptrdiff_t stride, int log2_size, int c_idx); - void (*pred_angular[4])(uint8_t *src, const uint8_t *top, - const uint8_t *left, ptrdiff_t stride, - int c_idx, int mode); -} HEVCPredContext; - typedef struct HEVCLocalContext { DECLARE_ALIGNED(16, int16_t, mc_buffer[(MAX_PB_SIZE + 7) * MAX_PB_SIZE]); uint8_t cabac_state[HEVC_CONTEXTS]; @@ -737,13 +723,14 @@ typedef struct HEVCLocalContext { int8_t qp_y; int8_t curr_qp_y; + int qPy_pred; + TransformUnit tu; uint8_t ctb_left_flag; uint8_t ctb_up_flag; uint8_t ctb_up_right_flag; uint8_t ctb_up_left_flag; - int start_of_tiles_x; int end_of_tiles_x; int end_of_tiles_y; /* +7 is for subpixel interpolation, *2 for high bit depths */ @@ -761,9 +748,18 @@ typedef struct HEVCContext { const AVClass *c; // needed by private avoptions AVCodecContext *avctx; - HEVCLocalContext HEVClc; + struct HEVCContext *sList[MAX_NB_THREADS]; - uint8_t cabac_state[HEVC_CONTEXTS]; + HEVCLocalContext *HEVClcList[MAX_NB_THREADS]; + HEVCLocalContext *HEVClc; + + uint8_t threads_type; + uint8_t threads_number; + + int width; + int height; + + uint8_t *cabac_state; /** 1 if the independent slice segment header was successfully parsed */ uint8_t slice_initialized; @@ -837,6 +833,18 @@ typedef struct HEVCContext { uint16_t seq_decode; uint16_t seq_output; + int enable_parallel_tiles; + int wpp_err; + int skipped_bytes; + int *skipped_bytes_pos; + int skipped_bytes_pos_size; + + int *skipped_bytes_nal; + int **skipped_bytes_pos_nal; + int *skipped_bytes_pos_size_nal; + + uint8_t *data; + HEVCNAL *nals; int nb_nals; int nals_allocated; @@ -853,6 +861,8 @@ typedef struct HEVCContext { ///< as a format defined in 14496-15 int apply_defdispwin; + int active_seq_parameter_set_id; + int nal_length_size; ///< Number of bytes used for nal length (1, 2 or 4) int nuh_layer_id; @@ -861,6 +871,8 @@ typedef struct HEVCContext { int frame_packing_arrangement_type; int content_interpretation_type; int quincunx_subsampling; + + int picture_struct; } HEVCContext; int ff_hevc_decode_short_term_rps(HEVCContext *s, ShortTermRPS *rps, @@ -870,6 +882,9 @@ int ff_hevc_decode_nal_sps(HEVCContext *s); int ff_hevc_decode_nal_pps(HEVCContext *s); int ff_hevc_decode_nal_sei(HEVCContext *s); +int ff_hevc_extract_rbsp(HEVCContext *s, const uint8_t *src, int length, + HEVCNAL *nal); + /** * Mark all frames in DPB as unused for reference. */ @@ -925,32 +940,10 @@ int ff_hevc_inter_pred_idc_decode(HEVCContext *s, int nPbW, int nPbH); int ff_hevc_ref_idx_lx_decode(HEVCContext *s, int num_ref_idx_lx); int ff_hevc_mvp_lx_flag_decode(HEVCContext *s); int ff_hevc_no_residual_syntax_flag_decode(HEVCContext *s); -int ff_hevc_abs_mvd_greater0_flag_decode(HEVCContext *s); -int ff_hevc_abs_mvd_greater1_flag_decode(HEVCContext *s); -int ff_hevc_mvd_decode(HEVCContext *s); -int ff_hevc_mvd_sign_flag_decode(HEVCContext *s); int ff_hevc_split_transform_flag_decode(HEVCContext *s, int log2_trafo_size); int ff_hevc_cbf_cb_cr_decode(HEVCContext *s, int trafo_depth); int ff_hevc_cbf_luma_decode(HEVCContext *s, int trafo_depth); int ff_hevc_transform_skip_flag_decode(HEVCContext *s, int c_idx); -int ff_hevc_last_significant_coeff_x_prefix_decode(HEVCContext *s, int c_idx, - int log2_size); -int ff_hevc_last_significant_coeff_y_prefix_decode(HEVCContext *s, int c_idx, - int log2_size); -int ff_hevc_last_significant_coeff_suffix_decode(HEVCContext *s, - int last_significant_coeff_prefix); -int ff_hevc_significant_coeff_group_flag_decode(HEVCContext *s, int c_idx, - int ctx_cg); -int ff_hevc_significant_coeff_flag_decode(HEVCContext *s, int c_idx, int x_c, - int y_c, int log2_trafo_size, - int scan_idx, int prev_sig); -int ff_hevc_coeff_abs_level_greater1_flag_decode(HEVCContext *s, int c_idx, - int ctx_set); -int ff_hevc_coeff_abs_level_greater2_flag_decode(HEVCContext *s, int c_idx, - int inc); -int ff_hevc_coeff_abs_level_remaining(HEVCContext *s, int base_level, - int rc_rice_param); -int ff_hevc_coeff_sign_flag(HEVCContext *s, uint8_t nb); /** * Get the number of candidate references for the current frame. @@ -986,10 +979,12 @@ 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); void ff_hevc_hls_filters(HEVCContext *s, int x_ctb, int y_ctb, int ctb_size); +void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, + int log2_trafo_size, enum ScanType scan_idx, + int c_idx); -void ff_hevc_pps_free(HEVCPPS **ppps); +void ff_hevc_hls_mvd_coding(HEVCContext *s, int x0, int y0, int log2_cb_size); -void ff_hevc_pred_init(HEVCPredContext *hpc, int bit_depth); extern const uint8_t ff_hevc_qpel_extra_before[4]; extern const uint8_t ff_hevc_qpel_extra_after[4]; |