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

h264: move relevant fields from Picture to H264Picture

This commit is contained in:
Vittorio Giovara 2014-03-12 09:13:07 +01:00
parent d66e305bd1
commit 9b749c8274
8 changed files with 148 additions and 90 deletions

View File

@ -44,7 +44,7 @@ static void fill_picture_entry(DXVA_PicEntry_H264 *pic,
static void fill_picture_parameters(struct dxva_context *ctx, const H264Context *h,
DXVA_PicParams_H264 *pp)
{
const Picture *current_picture = h->cur_pic_ptr;
const H264Picture *current_picture = h->cur_pic_ptr;
int i, j;
memset(pp, 0, sizeof(*pp));
@ -56,7 +56,7 @@ static void fill_picture_parameters(struct dxva_context *ctx, const H264Context
pp->UsedForReferenceFlags = 0;
pp->NonExistingFrameFlags = 0;
for (i = 0, j = 0; i < FF_ARRAY_ELEMS(pp->RefFrameList); i++) {
const Picture *r;
const H264Picture *r;
if (j < h->short_ref_count) {
r = h->short_ref[j++];
} else {
@ -226,7 +226,7 @@ static void fill_slice_long(AVCodecContext *avctx, DXVA_Slice_H264_Long *slice,
unsigned i;
for (i = 0; i < FF_ARRAY_ELEMS(slice->RefPicList[list]); i++) {
if (list < h->list_count && i < h->ref_count[list]) {
const Picture *r = &h->ref_list[list][i];
const H264Picture *r = &h->ref_list[list][i];
unsigned plane;
fill_picture_entry(&slice->RefPicList[list][i],
ff_dxva2_get_surface_index(ctx, r),
@ -277,7 +277,7 @@ static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx,
const H264Context *h = avctx->priv_data;
const unsigned mb_count = h->mb_width * h->mb_height;
struct dxva_context *ctx = avctx->hwaccel_context;
const Picture *current_picture = h->cur_pic_ptr;
const H264Picture *current_picture = h->cur_pic_ptr;
struct dxva2_picture_context *ctx_pic = current_picture->hwaccel_picture_private;
DXVA_Slice_H264_Short *slice = NULL;
uint8_t *dxva_data, *current, *end;
@ -397,7 +397,7 @@ static int dxva2_h264_decode_slice(AVCodecContext *avctx,
{
const H264Context *h = avctx->priv_data;
struct dxva_context *ctx = avctx->hwaccel_context;
const Picture *current_picture = h->cur_pic_ptr;
const H264Picture *current_picture = h->cur_pic_ptr;
struct dxva2_picture_context *ctx_pic = current_picture->hwaccel_picture_private;
unsigned position;

View File

@ -253,9 +253,9 @@ void ff_h264_draw_horiz_band(H264Context *h, int y, int height)
}
}
static void unref_picture(H264Context *h, Picture *pic)
static void unref_picture(H264Context *h, H264Picture *pic)
{
int off = offsetof(Picture, tf) + sizeof(pic->tf);
int off = offsetof(H264Picture, tf) + sizeof(pic->tf);
int i;
if (!pic->f.buf[0])
@ -287,7 +287,7 @@ static void release_unused_pictures(H264Context *h, int remove_current)
}
}
static int ref_picture(H264Context *h, Picture *dst, Picture *src)
static int ref_picture(H264Context *h, H264Picture *dst, H264Picture *src)
{
int ret, i;
@ -398,7 +398,7 @@ static int init_table_pools(H264Context *h)
return 0;
}
static int alloc_picture(H264Context *h, Picture *pic)
static int alloc_picture(H264Context *h, H264Picture *pic)
{
int i, ret = 0;
@ -454,7 +454,7 @@ fail:
return (ret < 0) ? ret : AVERROR(ENOMEM);
}
static inline int pic_is_unused(H264Context *h, Picture *pic)
static inline int pic_is_unused(H264Context *h, H264Picture *pic)
{
if (!pic->f.buf[0])
return 1;
@ -701,7 +701,7 @@ static int decode_rbsp_trailing(H264Context *h, const uint8_t *src)
return 0;
}
static inline int get_lowest_part_list_y(H264Context *h, Picture *pic, int n,
static inline int get_lowest_part_list_y(H264Context *h, H264Picture *pic, int n,
int height, int y_offset, int list)
{
int raw_my = h->mv_cache[list][scan8[n]][1];
@ -724,7 +724,7 @@ static inline void get_lowest_part_y(H264Context *h, int refs[2][48], int n,
if (list0) {
int ref_n = h->ref_cache[0][scan8[n]];
Picture *ref = &h->ref_list[0][ref_n];
H264Picture *ref = &h->ref_list[0][ref_n];
// Error resilience puts the current picture in the ref list.
// Don't try to wait on these as it will cause a deadlock.
@ -740,7 +740,7 @@ static inline void get_lowest_part_y(H264Context *h, int refs[2][48], int n,
if (list1) {
int ref_n = h->ref_cache[1][scan8[n]];
Picture *ref = &h->ref_list[1][ref_n];
H264Picture *ref = &h->ref_list[1][ref_n];
if (ref->tf.progress->data != h->cur_pic.tf.progress->data ||
(ref->reference & 3) != h->picture_structure) {
@ -831,7 +831,7 @@ static void await_references(H264Context *h)
for (ref = 0; ref < 48 && nrefs[list]; ref++) {
int row = refs[list][ref];
if (row >= 0) {
Picture *ref_pic = &h->ref_list[list][ref];
H264Picture *ref_pic = &h->ref_list[list][ref];
int ref_field = ref_pic->reference - 1;
int ref_field_picture = ref_pic->field_picture;
int pic_height = 16 * h->mb_height >> ref_field_picture;
@ -865,7 +865,7 @@ static void await_references(H264Context *h)
}
}
static av_always_inline void mc_dir_part(H264Context *h, Picture *pic,
static av_always_inline void mc_dir_part(H264Context *h, H264Picture *pic,
int n, int square, int height,
int delta, int list,
uint8_t *dest_y, uint8_t *dest_cb,
@ -1010,7 +1010,7 @@ static av_always_inline void mc_part_std(H264Context *h, int n, int square,
y_offset += 8 * (h->mb_y >> MB_FIELD(h));
if (list0) {
Picture *ref = &h->ref_list[0][h->ref_cache[0][scan8[n]]];
H264Picture *ref = &h->ref_list[0][h->ref_cache[0][scan8[n]]];
mc_dir_part(h, ref, n, square, height, delta, 0,
dest_y, dest_cb, dest_cr, x_offset, y_offset,
qpix_op, chroma_op, pixel_shift, chroma_idc);
@ -1020,7 +1020,7 @@ static av_always_inline void mc_part_std(H264Context *h, int n, int square,
}
if (list1) {
Picture *ref = &h->ref_list[1][h->ref_cache[1][scan8[n]]];
H264Picture *ref = &h->ref_list[1][h->ref_cache[1][scan8[n]]];
mc_dir_part(h, ref, n, square, height, delta, 1,
dest_y, dest_cb, dest_cr, x_offset, y_offset,
qpix_op, chroma_op, pixel_shift, chroma_idc);
@ -1112,7 +1112,7 @@ static av_always_inline void mc_part_weighted(H264Context *h, int n, int square,
} else {
int list = list1 ? 1 : 0;
int refn = h->ref_cache[list][scan8[n]];
Picture *ref = &h->ref_list[list][refn];
H264Picture *ref = &h->ref_list[list][refn];
mc_dir_part(h, ref, n, square, height, delta, list,
dest_y, dest_cb, dest_cr, x_offset, y_offset,
qpix_put, chroma_put, pixel_shift, chroma_idc);
@ -1598,7 +1598,7 @@ av_cold int ff_h264_decode_init(AVCodecContext *avctx)
pic < old_ctx->DPB + MAX_PICTURE_COUNT) ? \
&new_ctx->DPB[pic - old_ctx->DPB] : NULL)
static void copy_picture_range(Picture **to, Picture **from, int count,
static void copy_picture_range(H264Picture **to, H264Picture **from, int count,
H264Context *new_base,
H264Context *old_base)
{
@ -1607,7 +1607,7 @@ static void copy_picture_range(Picture **to, Picture **from, int count,
for (i = 0; i < count; i++) {
assert((IN_RANGE(from[i], old_base, sizeof(*old_base)) ||
IN_RANGE(from[i], old_base->DPB,
sizeof(Picture) * MAX_PICTURE_COUNT) ||
sizeof(H264Picture) * MAX_PICTURE_COUNT) ||
!from[i]));
to[i] = REBASE_PICTURE(from[i], new_base, old_base);
}
@ -1854,7 +1854,7 @@ static int decode_update_thread_context(AVCodecContext *dst,
static int h264_frame_start(H264Context *h)
{
Picture *pic;
H264Picture *pic;
int i, ret;
const int pixel_shift = h->pixel_shift;
@ -1946,8 +1946,8 @@ static int h264_frame_start(H264Context *h)
*/
static void decode_postinit(H264Context *h, int setup_finished)
{
Picture *out = h->cur_pic_ptr;
Picture *cur = h->cur_pic_ptr;
H264Picture *out = h->cur_pic_ptr;
H264Picture *cur = h->cur_pic_ptr;
int i, pics, out_of_order, out_idx;
int invalid = 0, cnt = 0;
@ -2934,6 +2934,27 @@ static void init_scan_tables(H264Context *h)
}
}
#if CONFIG_ERROR_RESILIENCE
static void h264_set_erpic(ERPicture *dst, H264Picture *src)
{
int i;
if (!src)
return;
dst->f = &src->f;
dst->tf = &src->tf;
for (i = 0; i < 2; i++) {
dst->motion_val[i] = src->motion_val[i];
dst->ref_index[i] = src->ref_index[i];
}
dst->mb_type = src->mb_type;
dst->field_picture = src->field_picture;
}
#endif /* CONFIG_ERROR_RESILIENCE */
static int field_end(H264Context *h, int in_setup)
{
AVCodecContext *const avctx = h->avctx;
@ -2974,10 +2995,10 @@ static int field_end(H264Context *h, int in_setup)
* causes problems for the first MB line, too.
*/
if (CONFIG_ERROR_RESILIENCE && !FIELD_PICTURE(h)) {
ff_mpeg_set_erpic(&h->er.cur_pic, h->cur_pic_ptr);
ff_mpeg_set_erpic(&h->er.last_pic,
h264_set_erpic(&h->er.cur_pic, h->cur_pic_ptr);
h264_set_erpic(&h->er.last_pic,
h->ref_count[0] ? &h->ref_list[0][0] : NULL);
ff_mpeg_set_erpic(&h->er.next_pic,
h264_set_erpic(&h->er.next_pic,
h->ref_count[1] ? &h->ref_list[1][0] : NULL);
ff_er_frame_end(&h->er);
}
@ -3628,7 +3649,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
while (h->frame_num != h->prev_frame_num &&
h->frame_num != (h->prev_frame_num + 1) % (1 << h->sps.log2_max_frame_num)) {
Picture *prev = h->short_ref_count ? h->short_ref[0] : NULL;
H264Picture *prev = h->short_ref_count ? h->short_ref[0] : NULL;
av_log(h->avctx, AV_LOG_DEBUG, "Frame num gap %d %d\n",
h->frame_num, h->prev_frame_num);
ret = h264_frame_start(h);
@ -4914,7 +4935,7 @@ static int h264_decode_frame(AVCodecContext *avctx, void *data,
/* end of stream, output what is still in the buffers */
out:
if (buf_size == 0) {
Picture *out;
H264Picture *out;
int i, out_idx;
h->cur_pic_ptr = NULL;

View File

@ -252,6 +252,43 @@ typedef struct MMCO {
int long_arg; ///< index, pic_num, or num long refs depending on opcode
} MMCO;
typedef struct H264Picture {
struct AVFrame f;
ThreadFrame tf;
AVBufferRef *qscale_table_buf;
int8_t *qscale_table;
AVBufferRef *motion_val_buf[2];
int16_t (*motion_val[2])[2];
AVBufferRef *mb_type_buf;
uint32_t *mb_type;
AVBufferRef *hwaccel_priv_buf;
void *hwaccel_picture_private; ///< hardware accelerator private data
AVBufferRef *ref_index_buf[2];
int8_t *ref_index[2];
int field_poc[2]; ///< top/bottom POC
int poc; ///< frame POC
int frame_num; ///< frame_num (raw frame_num from slice header)
int mmco_reset; /**< MMCO_RESET set this 1. Reordering code must
not mix pictures before and after MMCO_RESET. */
int pic_id; /**< pic_num (short -> no wrap version of pic_num,
pic_num & max_pic_num; long -> long_pic_num) */
int long_ref; ///< 1->long term reference 0->short term reference
int ref_poc[2][2][32]; ///< POCs of the frames used as reference (FIXME need per slice)
int ref_count[2][2]; ///< number of entries in ref_poc (FIXME need per slice)
int mbaff; ///< 1 -> MBAFF frame 0-> not MBAFF
int field_picture; ///< whether or not picture was encoded in separate fields
int needs_realloc; ///< picture needs to be reallocated (eg due to a frame size change)
int reference;
int recovered; ///< picture at IDR or recovery point + recovery count
} H264Picture;
/**
* H264Context
*/
@ -267,9 +304,9 @@ typedef struct H264Context {
GetBitContext gb;
ERContext er;
Picture *DPB;
Picture *cur_pic_ptr;
Picture cur_pic;
H264Picture *DPB;
H264Picture *cur_pic_ptr;
H264Picture cur_pic;
int pixel_shift; ///< 0 for 8-bit H264, 1 for high-bit-depth H264
int chroma_qp[2]; // QPc
@ -401,7 +438,7 @@ typedef struct H264Context {
unsigned int ref_count[2]; ///< counts frames or fields, depending on current mb mode
unsigned int list_count;
uint8_t *list_counts; ///< Array of list_count per MB specifying the slice type
Picture ref_list[2][48]; /**< 0..15: frame refs, 16..47: mbaff field refs.
H264Picture 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 */
int ref2frm[MAX_SLICES][2][64]; ///< reference to frame number lists, used in the loop filter, the first 2 are for -2,-1
@ -516,12 +553,12 @@ typedef struct H264Context {
int redundant_pic_count;
Picture default_ref_list[2][32]; ///< base reference list for all slices of a coded picture
Picture *short_ref[32];
Picture *long_ref[32];
Picture *delayed_pic[MAX_DELAYED_PIC_COUNT + 2]; // FIXME size?
H264Picture default_ref_list[2][32]; ///< base reference list for all slices of a coded picture
H264Picture *short_ref[32];
H264Picture *long_ref[32];
H264Picture *delayed_pic[MAX_DELAYED_PIC_COUNT + 2]; // FIXME size?
int last_pocs[MAX_DELAYED_PIC_COUNT];
Picture *next_output_pic;
H264Picture *next_output_pic;
int outputed_poc;
int next_outputed_poc;

View File

@ -67,7 +67,7 @@ void ff_h264_direct_dist_scale_factor(H264Context * const h){
}
static void fill_colmap(H264Context *h, int map[2][16+32], int list, int field, int colfield, int mbafi){
Picture * const ref1 = &h->ref_list[1][0];
H264Picture * const ref1 = &h->ref_list[1][0];
int j, old_ref, rfield;
int start= mbafi ? 16 : 0;
int end = mbafi ? 16+2*h->ref_count[0] : h->ref_count[0];
@ -100,8 +100,8 @@ static void fill_colmap(H264Context *h, int map[2][16+32], int list, int field,
}
void ff_h264_direct_ref_list_init(H264Context * const h){
Picture * const ref1 = &h->ref_list[1][0];
Picture * const cur = h->cur_pic_ptr;
H264Picture * const ref1 = &h->ref_list[1][0];
H264Picture * const cur = h->cur_pic_ptr;
int list, j, field;
int sidx= (h->picture_structure&1)^1;
int ref1sidx = (ref1->reference&1)^1;
@ -140,7 +140,7 @@ void ff_h264_direct_ref_list_init(H264Context * const h){
}
}
static void await_reference_mb_row(H264Context * const h, Picture *ref, int mb_y)
static void await_reference_mb_row(H264Context * const h, H264Picture *ref, int mb_y)
{
int ref_field = ref->reference - 1;
int ref_field_picture = ref->field_picture;

View File

@ -40,7 +40,7 @@ do {\
} while (0)
static void pic_as_field(Picture *pic, const int parity){
static void pic_as_field(H264Picture *pic, const int parity){
int i;
for (i = 0; i < 4; ++i) {
if (parity == PICT_BOTTOM_FIELD)
@ -51,7 +51,7 @@ static void pic_as_field(Picture *pic, const int parity){
pic->poc= pic->field_poc[parity == PICT_BOTTOM_FIELD];
}
static int split_field_copy(Picture *dest, Picture *src, int parity, int id_add)
static int split_field_copy(H264Picture *dest, H264Picture *src, int parity, int id_add)
{
int match = !!(src->reference & parity);
@ -67,8 +67,8 @@ static int split_field_copy(Picture *dest, Picture *src, int parity, int id_add)
return match;
}
static int build_def_list(Picture *def, int def_len,
Picture **in, int len, int is_long, int sel)
static int build_def_list(H264Picture *def, int def_len,
H264Picture **in, int len, int is_long, int sel)
{
int i[2] = { 0 };
int index = 0;
@ -91,7 +91,7 @@ static int build_def_list(Picture *def, int def_len,
return index;
}
static int add_sorted(Picture **sorted, Picture **src, int len, int limit, int dir)
static int add_sorted(H264Picture **sorted, H264Picture **src, int len, int limit, int dir)
{
int i, best_poc;
int out_i = 0;
@ -118,7 +118,7 @@ int ff_h264_fill_default_ref_list(H264Context *h)
int i, len;
if (h->slice_type_nos == AV_PICTURE_TYPE_B) {
Picture *sorted[32];
H264Picture *sorted[32];
int cur_poc, list;
int lens[2];
@ -139,7 +139,7 @@ int ff_h264_fill_default_ref_list(H264Context *h)
h->long_ref, 16, 1, h->picture_structure);
if (len < h->ref_count[list])
memset(&h->default_ref_list[list][len], 0, sizeof(Picture) * (h->ref_count[list] - len));
memset(&h->default_ref_list[list][len], 0, sizeof(H264Picture) * (h->ref_count[list] - len));
lens[list] = len;
}
@ -148,7 +148,7 @@ int ff_h264_fill_default_ref_list(H264Context *h)
h->default_ref_list[0][i].f.buf[0]->buffer ==
h->default_ref_list[1][i].f.buf[0]->buffer; i++);
if (i == lens[0]) {
Picture tmp;
H264Picture tmp;
COPY_PICTURE(&tmp, &h->default_ref_list[1][0]);
COPY_PICTURE(&h->default_ref_list[1][0], &h->default_ref_list[1][1]);
COPY_PICTURE(&h->default_ref_list[1][1], &tmp);
@ -162,7 +162,7 @@ int ff_h264_fill_default_ref_list(H264Context *h)
h-> long_ref, 16, 1, h->picture_structure);
if (len < h->ref_count[0])
memset(&h->default_ref_list[0][len], 0, sizeof(Picture) * (h->ref_count[0] - len));
memset(&h->default_ref_list[0][len], 0, sizeof(H264Picture) * (h->ref_count[0] - len));
}
#ifdef TRACE
for (i = 0; i < h->ref_count[0]; i++) {
@ -227,7 +227,7 @@ int ff_h264_decode_ref_pic_list_reordering(H264Context *h)
unsigned int modification_of_pic_nums_idc = get_ue_golomb_31(&h->gb);
unsigned int pic_id;
int i;
Picture *ref = NULL;
H264Picture *ref = NULL;
if (modification_of_pic_nums_idc == 3)
break;
@ -301,7 +301,7 @@ int ff_h264_decode_ref_pic_list_reordering(H264Context *h)
if (i < 0) {
av_log(h->avctx, AV_LOG_ERROR,
"reference picture missing during reorder\n");
memset(&h->ref_list[list][index], 0, sizeof(Picture)); // FIXME
memset(&h->ref_list[list][index], 0, sizeof(H264Picture)); // FIXME
} else {
for (i = index; i + 1 < h->ref_count[list]; i++) {
if (ref->long_ref == h->ref_list[list][i].long_ref &&
@ -339,8 +339,8 @@ void ff_h264_fill_mbaff_ref_list(H264Context *h)
int list, i, j;
for (list = 0; list < 2; list++) { //FIXME try list_count
for (i = 0; i < h->ref_count[list]; i++) {
Picture *frame = &h->ref_list[list][i];
Picture *field = &h->ref_list[list][16 + 2 * i];
H264Picture *frame = &h->ref_list[list][i];
H264Picture *field = &h->ref_list[list][16 + 2 * i];
COPY_PICTURE(field, frame);
for (j = 0; j < 3; j++)
field[0].f.linesize[j] <<= 1;
@ -373,7 +373,7 @@ void ff_h264_fill_mbaff_ref_list(H264Context *h)
* for display purposes) zero if one of the fields remains in
* reference
*/
static inline int unreference_pic(H264Context *h, Picture *pic, int refmask)
static inline int unreference_pic(H264Context *h, H264Picture *pic, int refmask)
{
int i;
if (pic->reference &= refmask) {
@ -389,19 +389,19 @@ static inline int unreference_pic(H264Context *h, Picture *pic, int refmask)
}
/**
* Find a Picture in the short term reference list by frame number.
* Find a H264Picture in the short term reference list by frame number.
* @param frame_num frame number to search for
* @param idx the index into h->short_ref where returned picture is found
* undefined if no picture found.
* @return pointer to the found picture, or NULL if no pic with the provided
* frame number is found
*/
static Picture *find_short(H264Context *h, int frame_num, int *idx)
static H264Picture *find_short(H264Context *h, int frame_num, int *idx)
{
int i;
for (i = 0; i < h->short_ref_count; i++) {
Picture *pic = h->short_ref[i];
H264Picture *pic = h->short_ref[i];
if (h->avctx->debug & FF_DEBUG_MMCO)
av_log(h->avctx, AV_LOG_DEBUG, "%d %d %p\n", i, pic->frame_num, pic);
if (pic->frame_num == frame_num) {
@ -424,16 +424,16 @@ static void remove_short_at_index(H264Context *h, int i)
h->short_ref[i] = NULL;
if (--h->short_ref_count)
memmove(&h->short_ref[i], &h->short_ref[i + 1],
(h->short_ref_count - i) * sizeof(Picture*));
(h->short_ref_count - i) * sizeof(H264Picture*));
}
/**
*
* @return the removed picture or NULL if an error occurs
*/
static Picture *remove_short(H264Context *h, int frame_num, int ref_mask)
static H264Picture *remove_short(H264Context *h, int frame_num, int ref_mask)
{
Picture *pic;
H264Picture *pic;
int i;
if (h->avctx->debug & FF_DEBUG_MMCO)
@ -453,9 +453,9 @@ static Picture *remove_short(H264Context *h, int frame_num, int ref_mask)
* that list.
* @return the removed picture or NULL if an error occurs
*/
static Picture *remove_long(H264Context *h, int i, int ref_mask)
static H264Picture *remove_long(H264Context *h, int i, int ref_mask)
{
Picture *pic;
H264Picture *pic;
pic = h->long_ref[i];
if (pic) {
@ -495,7 +495,7 @@ static void print_short_term(H264Context *h)
if (h->avctx->debug & FF_DEBUG_MMCO) {
av_log(h->avctx, AV_LOG_DEBUG, "short term list:\n");
for (i = 0; i < h->short_ref_count; i++) {
Picture *pic = h->short_ref[i];
H264Picture *pic = h->short_ref[i];
av_log(h->avctx, AV_LOG_DEBUG, "%d fn:%d poc:%d %p\n",
i, pic->frame_num, pic->poc, pic->f.data[0]);
}
@ -511,7 +511,7 @@ static void print_long_term(H264Context *h)
if (h->avctx->debug & FF_DEBUG_MMCO) {
av_log(h->avctx, AV_LOG_DEBUG, "long term list:\n");
for (i = 0; i < 16; i++) {
Picture *pic = h->long_ref[i];
H264Picture *pic = h->long_ref[i];
if (pic) {
av_log(h->avctx, AV_LOG_DEBUG, "%d fn:%d poc:%d %p\n",
i, pic->frame_num, pic->poc, pic->f.data[0]);
@ -570,7 +570,7 @@ int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count)
{
int i, av_uninit(j);
int current_ref_assigned = 0, err = 0;
Picture *av_uninit(pic);
H264Picture *av_uninit(pic);
if ((h->avctx->debug & FF_DEBUG_MMCO) && mmco_count == 0)
av_log(h->avctx, AV_LOG_DEBUG, "no mmco here\n");
@ -691,7 +691,7 @@ int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count)
if (h->short_ref_count)
memmove(&h->short_ref[1], &h->short_ref[0],
h->short_ref_count * sizeof(Picture*));
h->short_ref_count * sizeof(H264Picture*));
h->short_ref[0] = h->cur_pic_ptr;
h->short_ref_count++;

View File

@ -68,9 +68,9 @@
typedef struct {
H264Context h;
HpelDSPContext hdsp;
Picture *cur_pic;
Picture *next_pic;
Picture *last_pic;
H264Picture *cur_pic;
H264Picture *next_pic;
H264Picture *last_pic;
int halfpel_flag;
int thirdpel_flag;
int unknown_flag;
@ -292,7 +292,7 @@ static inline void svq3_mc_dir_part(SVQ3Context *s,
int thirdpel, int dir, int avg)
{
H264Context *h = &s->h;
const Picture *pic = (dir == 0) ? s->last_pic : s->next_pic;
const H264Picture *pic = (dir == 0) ? s->last_pic : s->next_pic;
uint8_t *src, *dest;
int i, emu = 0;
int blocksize = 2 - (width >> 3); // 16->0, 8->1, 4->2
@ -1030,7 +1030,7 @@ static av_cold int svq3_decode_init(AVCodecContext *avctx)
return 0;
}
static void free_picture(AVCodecContext *avctx, Picture *pic)
static void free_picture(AVCodecContext *avctx, H264Picture *pic)
{
int i;
for (i = 0; i < 2; i++) {
@ -1042,7 +1042,7 @@ static void free_picture(AVCodecContext *avctx, Picture *pic)
av_frame_unref(&pic->f);
}
static int get_buffer(AVCodecContext *avctx, Picture *pic)
static int get_buffer(AVCodecContext *avctx, H264Picture *pic)
{
SVQ3Context *s = avctx->priv_data;
H264Context *h = &s->h;
@ -1125,7 +1125,7 @@ static int svq3_decode_frame(AVCodecContext *avctx, void *data,
h->pict_type = h->slice_type;
if (h->pict_type != AV_PICTURE_TYPE_B)
FFSWAP(Picture*, s->next_pic, s->last_pic);
FFSWAP(H264Picture*, s->next_pic, s->last_pic);
av_frame_unref(&s->cur_pic->f);
@ -1285,7 +1285,7 @@ static int svq3_decode_frame(AVCodecContext *avctx, void *data,
*got_frame = 1;
if (h->pict_type != AV_PICTURE_TYPE_B) {
FFSWAP(Picture*, s->cur_pic, s->next_pic);
FFSWAP(H264Picture*, s->cur_pic, s->next_pic);
} else {
av_frame_unref(&s->cur_pic->f);
}

View File

@ -51,7 +51,7 @@ static void init_vaapi_pic(VAPictureH264 *va_pic)
* supersedes pic's field type if nonzero.
*/
static void fill_vaapi_pic(VAPictureH264 *va_pic,
Picture *pic,
H264Picture *pic,
int pic_structure)
{
if (pic_structure == 0)
@ -89,7 +89,7 @@ typedef struct DPB {
* available. The decoded picture buffer's size must be large enough
* to receive the new VA API picture object.
*/
static int dpb_add(DPB *dpb, Picture *pic)
static int dpb_add(DPB *dpb, H264Picture *pic)
{
int i;
@ -133,13 +133,13 @@ static int fill_vaapi_ReferenceFrames(VAPictureParameterBufferH264 *pic_param,
init_vaapi_pic(&dpb.va_pics[i]);
for (i = 0; i < h->short_ref_count; i++) {
Picture * const pic = h->short_ref[i];
H264Picture * const pic = h->short_ref[i];
if (pic && pic->reference && dpb_add(&dpb, pic) < 0)
return -1;
}
for (i = 0; i < 16; i++) {
Picture * const pic = h->long_ref[i];
H264Picture * const pic = h->long_ref[i];
if (pic && pic->reference && dpb_add(&dpb, pic) < 0)
return -1;
}
@ -155,7 +155,7 @@ static int fill_vaapi_ReferenceFrames(VAPictureParameterBufferH264 *pic_param,
* @param[in] ref_count The number of reference pictures in ref_list
*/
static void fill_vaapi_RefPicList(VAPictureH264 RefPicList[32],
Picture *ref_list,
H264Picture *ref_list,
unsigned int ref_count)
{
unsigned int i, n = 0;

View File

@ -46,7 +46,7 @@ static void vdpau_h264_clear_rf(VdpReferenceFrameH264 *rf)
rf->frame_idx = 0;
}
static void vdpau_h264_set_rf(VdpReferenceFrameH264 *rf, Picture *pic,
static void vdpau_h264_set_rf(VdpReferenceFrameH264 *rf, H264Picture *pic,
int pic_structure)
{
VdpVideoSurface surface = ff_vdpau_get_surface_id(pic);
@ -74,11 +74,11 @@ static void vdpau_h264_set_reference_frames(AVCodecContext *avctx)
#define H264_RF_COUNT FF_ARRAY_ELEMS(info->referenceFrames)
for (list = 0; list < 2; ++list) {
Picture **lp = list ? h->long_ref : h->short_ref;
H264Picture **lp = list ? h->long_ref : h->short_ref;
int i, ls = list ? 16 : h->short_ref_count;
for (i = 0; i < ls; ++i) {
Picture *pic = lp[i];
H264Picture *pic = lp[i];
VdpReferenceFrameH264 *rf2;
VdpVideoSurface surface_ref;
int pic_frame_idx;
@ -118,7 +118,7 @@ static int vdpau_h264_start_frame(AVCodecContext *avctx,
const uint8_t *buffer, uint32_t size)
{
H264Context * const h = avctx->priv_data;
Picture *pic = h->cur_pic_ptr;
H264Picture *pic = h->cur_pic_ptr;
struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private;
VdpPictureInfoH264 *info = &pic_ctx->info.h264;
@ -170,7 +170,7 @@ static int vdpau_h264_decode_slice(AVCodecContext *avctx,
const uint8_t *buffer, uint32_t size)
{
H264Context *h = avctx->priv_data;
Picture *pic = h->cur_pic_ptr;
H264Picture *pic = h->cur_pic_ptr;
struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private;
int val;
@ -190,7 +190,7 @@ static int vdpau_h264_end_frame(AVCodecContext *avctx)
{
AVVDPAUContext *hwctx = avctx->hwaccel_context;
H264Context *h = avctx->priv_data;
Picture *pic = h->cur_pic_ptr;
H264Picture *pic = h->cur_pic_ptr;
struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private;
VdpVideoSurface surf = ff_vdpau_get_surface_id(pic);