#include "bswapdsp.h"
#include "cabac.h"
#include "get_bits.h"
+#include "h2645_parse.h"
#include "hevcdsp.h"
#include "internal.h"
#include "thread.h"
typedef struct ShortTermRPS {
unsigned int num_negative_pics;
int num_delta_pocs;
+ int rps_idx_num_delta_pocs;
int32_t delta_poc[32];
uint8_t used[32];
} ShortTermRPS;
int *min_tb_addr_zs; ///< MinTbAddrZS
} HEVCPPS;
+typedef struct HEVCParamSets {
+ AVBufferRef *vps_list[MAX_VPS_COUNT];
+ AVBufferRef *sps_list[MAX_SPS_COUNT];
+ AVBufferRef *pps_list[MAX_PPS_COUNT];
+
+ /* currently active parameter sets */
+ const HEVCVPS *vps;
+ const HEVCSPS *sps;
+ const HEVCPPS *pps;
+} HEVCParamSets;
+
typedef struct SliceHeader {
unsigned int pps_id;
int short_term_ref_pic_set_size;
ShortTermRPS slice_rps;
const ShortTermRPS *short_term_rps;
+ int long_term_ref_pic_set_size;
LongTermRPS long_term_rps;
unsigned int list_entry_lx[2][32];
uint8_t flags;
} HEVCFrame;
-typedef struct HEVCNAL {
- uint8_t *rbsp_buffer;
- int rbsp_buffer_size;
-
- int size;
- const uint8_t *data;
-
- int raw_size;
- const uint8_t *raw_data;
-} HEVCNAL;
-
struct HEVCContext;
typedef struct HEVCPredContext {
} HEVCPredContext;
typedef struct HEVCLocalContext {
- DECLARE_ALIGNED(16, int16_t, mc_buffer[(MAX_PB_SIZE + 7) * MAX_PB_SIZE]);
+ DECLARE_ALIGNED(16, int16_t, mc_buffer[(MAX_PB_SIZE + 24) * MAX_PB_SIZE]);
uint8_t cabac_state[HEVC_CONTEXTS];
uint8_t first_qp_group;
AVFrame *tmp_frame;
AVFrame *output_frame;
- const HEVCVPS *vps;
- const HEVCSPS *sps;
- const HEVCPPS *pps;
- AVBufferRef *vps_list[MAX_VPS_COUNT];
- AVBufferRef *sps_list[MAX_SPS_COUNT];
- AVBufferRef *pps_list[MAX_PPS_COUNT];
+ HEVCParamSets ps;
AVBufferPool *tab_mvf_pool;
AVBufferPool *rpl_tab_pool;
uint16_t seq_decode;
uint16_t seq_output;
- HEVCNAL *nals;
- int nb_nals;
- int nals_allocated;
+ H2645Packet pkt;
// type of the first VCL NAL of the current frame
enum NALUnitType first_nal_type;
int sei_hflip, sei_vflip;
} HEVCContext;
-int ff_hevc_decode_short_term_rps(HEVCContext *s, ShortTermRPS *rps,
- const HEVCSPS *sps, int is_slice_header);
-int ff_hevc_decode_nal_vps(HEVCContext *s);
-int ff_hevc_decode_nal_sps(HEVCContext *s);
-int ff_hevc_decode_nal_pps(HEVCContext *s);
+int ff_hevc_decode_short_term_rps(GetBitContext *gb, AVCodecContext *avctx,
+ ShortTermRPS *rps, const HEVCSPS *sps, int is_slice_header);
+
+/**
+ * Parse the SPS from the bitstream into the provided HEVCSPS struct.
+ *
+ * @param sps_id the SPS id will be written here
+ * @param apply_defdispwin if set 1, the default display window from the VUI
+ * will be applied to the video dimensions
+ * @param vps_list if non-NULL, this function will validate that the SPS refers
+ * to an existing VPS
+ */
+int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id,
+ int apply_defdispwin, AVBufferRef **vps_list, AVCodecContext *avctx);
+
+int ff_hevc_decode_nal_vps(GetBitContext *gb, AVCodecContext *avctx,
+ HEVCParamSets *ps);
+int ff_hevc_decode_nal_sps(GetBitContext *gb, AVCodecContext *avctx,
+ HEVCParamSets *ps, int apply_defdispwin);
+int ff_hevc_decode_nal_pps(GetBitContext *gb, AVCodecContext *avctx,
+ HEVCParamSets *ps);
int ff_hevc_decode_nal_sei(HEVCContext *s);
/**
void ff_hevc_pred_init(HEVCPredContext *hpc, int bit_depth);
+int ff_hevc_encode_nal_vps(HEVCVPS *vps, unsigned int id,
+ uint8_t *buf, int buf_size);
+
extern const uint8_t ff_hevc_qpel_extra_before[4];
extern const uint8_t ff_hevc_qpel_extra_after[4];
extern const uint8_t ff_hevc_qpel_extra[4];