#include "libavutil/buffer.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/thread.h"
+
#include "cabac.h"
#include "error_resilience.h"
-#include "get_bits.h"
#include "h264_parse.h"
#include "h264_sei.h"
#include "h2645_parse.h"
AVBufferRef *sps_ref;
/* currently active parameters sets */
const PPS *pps;
- // FIXME this should properly be const
- SPS *sps;
+ const SPS *sps;
} H264ParamSets;
/**
int mb_xy;
int resync_mb_x;
int resync_mb_y;
+ unsigned int first_mb_addr;
// index of the first MB of the next slice
int next_slice_idx;
int mb_skip_run;
int is_complex;
+ int picture_structure;
int mb_field_decoding_flag;
int mb_mbaff; ///< mb_aff_frame && mb_field_decoding_flag
H264Ref ref_list[2][48]; /**< 0..15: frame refs, 16..47: mbaff field refs.
* Reordered version of default_ref_list
* according to picture reordering in slice header */
+ struct {
+ uint8_t op;
+ uint32_t val;
+ } ref_modifications[2][32];
+ int nb_ref_modifications[2];
+
+ unsigned int pps_id;
const uint8_t *intra_pcm_ptr;
int16_t *dc_val_base;
CABACContext cabac;
uint8_t cabac_state[1024];
int cabac_init_idc;
+
+ MMCO mmco[MAX_MMCO_COUNT];
+ int nb_mmco;
+ int explicit_ref_marking;
+
+ int frame_num;
+ int poc_lsb;
+ int delta_poc_bottom;
+ int delta_poc[2];
+ int curr_pic_num;
+ int max_pic_num;
} H264SliceContext;
/**
H264DSPContext h264dsp;
H264ChromaContext h264chroma;
H264QpelContext h264qpel;
- GetBitContext gb;
H264Picture DPB[H264_MAX_PICTURE_COUNT];
H264Picture *cur_pic_ptr;
uint32_t *mb2br_xy;
int b_stride; // FIXME use s->b4_stride
-
- unsigned current_sps_id; ///< id of the current SPS
-
- int au_pps_id; ///< pps_id of current access unit
-
uint16_t *slice_table; ///< slice_table_base + 2*mb_stride + 1
// interlacing specific flags
H264POCContext poc;
- /**
- * frame_num for frames or 2 * frame_num + 1 for field pics.
- */
- int curr_pic_num;
-
- /**
- * max_frame_num or 2 * max_frame_num for field pics.
- */
- int max_pic_num;
-
H264Ref default_ref[2];
H264Picture *short_ref[32];
H264Picture *long_ref[32];
* memory management control operations buffer.
*/
MMCO mmco[MAX_MMCO_COUNT];
- int mmco_index;
+ int nb_mmco;
int mmco_reset;
+ int explicit_ref_marking;
int long_ref_count; ///< number of actual long term references
int short_ref_count; ///< number of actual short term references
int missing_fields;
-/* for frame threading, this is set to 1
+ /* for frame threading, this is set to 1
* after finish_setup() has been called, so we cannot modify
* some context properties (which are supposed to stay constant between
* slices) anymore */
*/
int ff_h264_alloc_tables(H264Context *h);
-int ff_h264_decode_ref_pic_list_reordering(H264Context *h, H264SliceContext *sl);
-void ff_h264_fill_mbaff_ref_list(H264SliceContext *sl);
+int ff_h264_decode_ref_pic_list_reordering(const H264Context *h, H264SliceContext *sl);
+int ff_h264_build_ref_list(H264Context *h, H264SliceContext *sl);
void ff_h264_remove_all_refs(H264Context *h);
/**
* Execute the reference picture marking (memory management control operations).
*/
-int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count);
-
-int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb,
- int first_slice);
+int ff_h264_execute_ref_pic_marking(H264Context *h);
-int ff_generate_sliding_window_mmcos(H264Context *h, int first_slice);
+int ff_h264_decode_ref_pic_marking(const H264Context *h, H264SliceContext *sl,
+ GetBitContext *gb);
void ff_h264_hl_decode_mb(const H264Context *h, H264SliceContext *sl);
int ff_h264_decode_init(AVCodecContext *avctx);
/**
* Get the chroma qp.
*/
-static av_always_inline int get_chroma_qp(const H264Context *h, int t, int qscale)
+static av_always_inline int get_chroma_qp(const PPS *pps, int t, int qscale)
{
- return h->ps.pps->chroma_qp_table[t][qscale];
+ return pps->chroma_qp_table[t][qscale];
}
/**
void ff_h264_draw_horiz_band(const H264Context *h, H264SliceContext *sl, int y, int height);
-int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl);
+int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl,
+ const H2645NAL *nal);
#define SLICE_SINGLETHREAD 1
#define SLICE_SKIPED 2