summaryrefslogtreecommitdiff
path: root/libavcodec/h264_slice.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-04-29 15:44:21 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-04-29 16:35:24 +0200
commit36f862e04c2afe37c1fd541e01013c6cef4c6015 (patch)
tree3983371af49a7234d87bf999b35b17875db09a64 /libavcodec/h264_slice.c
parent07a79cf8694ac685ae8f579ccc33d113eb46fe3d (diff)
parenta0f2946068c62e18cb05ac25c0df3d86077251a6 (diff)
Merge commit 'a0f2946068c62e18cb05ac25c0df3d86077251a6'
* commit 'a0f2946068c62e18cb05ac25c0df3d86077251a6': h264: use properly allocated AVFrames Conflicts: libavcodec/h264.c libavcodec/h264.h libavcodec/h264_refs.c libavcodec/h264_slice.c libavcodec/svq3.c libavcodec/vda_h264.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/h264_slice.c')
-rw-r--r--libavcodec/h264_slice.c68
1 files changed, 34 insertions, 34 deletions
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index db6288d842..9188eb471e 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -154,7 +154,7 @@ static void release_unused_pictures(H264Context *h, int remove_current)
/* release non reference frames */
for (i = 0; i < H264_MAX_PICTURE_COUNT; i++) {
- if (h->DPB[i].f.buf[0] && !h->DPB[i].reference &&
+ if (h->DPB[i].f->buf[0] && !h->DPB[i].reference &&
(remove_current || &h->DPB[i] != h->cur_pic_ptr)) {
ff_h264_unref_picture(h, &h->DPB[i]);
}
@@ -224,9 +224,9 @@ static int alloc_picture(H264Context *h, H264Picture *pic)
{
int i, ret = 0;
- av_assert0(!pic->f.data[0]);
+ av_assert0(!pic->f->data[0]);
- pic->tf.f = &pic->f;
+ pic->tf.f = pic->f;
ret = ff_thread_get_buffer(h->avctx, &pic->tf, pic->reference ?
AV_GET_BUFFER_FLAG_REF : 0);
if (ret < 0)
@@ -246,15 +246,15 @@ static int alloc_picture(H264Context *h, H264Picture *pic)
pic->hwaccel_picture_private = pic->hwaccel_priv_buf->data;
}
}
- if (CONFIG_GRAY && !h->avctx->hwaccel && h->flags & CODEC_FLAG_GRAY && pic->f.data[2]) {
+ if (CONFIG_GRAY && !h->avctx->hwaccel && h->flags & CODEC_FLAG_GRAY && pic->f->data[2]) {
int h_chroma_shift, v_chroma_shift;
- av_pix_fmt_get_chroma_sub_sample(pic->f.format,
+ av_pix_fmt_get_chroma_sub_sample(pic->f->format,
&h_chroma_shift, &v_chroma_shift);
for(i=0; i<FF_CEIL_RSHIFT(h->avctx->height, v_chroma_shift); i++) {
- memset(pic->f.data[1] + pic->f.linesize[1]*i,
+ memset(pic->f->data[1] + pic->f->linesize[1]*i,
0x80, FF_CEIL_RSHIFT(h->avctx->width, h_chroma_shift));
- memset(pic->f.data[2] + pic->f.linesize[2]*i,
+ memset(pic->f->data[2] + pic->f->linesize[2]*i,
0x80, FF_CEIL_RSHIFT(h->avctx->width, h_chroma_shift));
}
}
@@ -291,7 +291,7 @@ fail:
static inline int pic_is_unused(H264Context *h, H264Picture *pic)
{
- if (!pic->f.buf[0])
+ if (!pic->f->buf[0])
return 1;
return 0;
}
@@ -500,14 +500,14 @@ int ff_h264_update_thread_context(AVCodecContext *dst,
for (i = 0; i < H264_MAX_PICTURE_COUNT; i++) {
ff_h264_unref_picture(h, &h->DPB[i]);
- if (h1->DPB[i].f.buf[0] &&
+ if (h1->DPB[i].f->buf[0] &&
(ret = ff_h264_ref_picture(h, &h->DPB[i], &h1->DPB[i])) < 0)
return ret;
}
h->cur_pic_ptr = REBASE_PICTURE(h1->cur_pic_ptr, h, h1);
ff_h264_unref_picture(h, &h->cur_pic);
- if (h1->cur_pic.f.buf[0]) {
+ if (h1->cur_pic.f->buf[0]) {
ret = ff_h264_ref_picture(h, &h->cur_pic, &h1->cur_pic);
if (ret < 0)
return ret;
@@ -594,7 +594,7 @@ static int h264_frame_start(H264Context *h)
pic = &h->DPB[i];
pic->reference = h->droppable ? 0 : h->picture_structure;
- pic->f.coded_picture_number = h->coded_picture_number++;
+ pic->f->coded_picture_number = h->coded_picture_number++;
pic->field_picture = h->picture_structure != PICT_FRAME;
/*
@@ -602,7 +602,7 @@ static int h264_frame_start(H264Context *h)
* in later.
* See decode_nal_units().
*/
- pic->f.key_frame = 0;
+ pic->f->key_frame = 0;
pic->mmco_reset = 0;
pic->recovered = 0;
pic->invalid_gap = 0;
@@ -612,7 +612,7 @@ static int h264_frame_start(H264Context *h)
return ret;
if(!h->frame_recovered && !h->avctx->hwaccel &&
!(h->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU))
- avpriv_color_frame(&pic->f, c);
+ avpriv_color_frame(pic->f, c);
h->cur_pic_ptr = pic;
ff_h264_unref_picture(h, &h->cur_pic);
@@ -624,8 +624,8 @@ static int h264_frame_start(H264Context *h)
return ret;
for (i = 0; i < h->nb_slice_ctx; i++) {
- h->slice_ctx[i].linesize = h->cur_pic_ptr->f.linesize[0];
- h->slice_ctx[i].uvlinesize = h->cur_pic_ptr->f.linesize[1];
+ h->slice_ctx[i].linesize = h->cur_pic_ptr->f->linesize[0];
+ h->slice_ctx[i].uvlinesize = h->cur_pic_ptr->f->linesize[1];
}
if (CONFIG_ERROR_RESILIENCE && h->enable_er) {
@@ -635,14 +635,14 @@ static int h264_frame_start(H264Context *h)
}
for (i = 0; i < 16; i++) {
- h->block_offset[i] = (4 * ((scan8[i] - scan8[0]) & 7) << pixel_shift) + 4 * pic->f.linesize[0] * ((scan8[i] - scan8[0]) >> 3);
- h->block_offset[48 + i] = (4 * ((scan8[i] - scan8[0]) & 7) << pixel_shift) + 8 * pic->f.linesize[0] * ((scan8[i] - scan8[0]) >> 3);
+ h->block_offset[i] = (4 * ((scan8[i] - scan8[0]) & 7) << pixel_shift) + 4 * pic->f->linesize[0] * ((scan8[i] - scan8[0]) >> 3);
+ h->block_offset[48 + i] = (4 * ((scan8[i] - scan8[0]) & 7) << pixel_shift) + 8 * pic->f->linesize[0] * ((scan8[i] - scan8[0]) >> 3);
}
for (i = 0; i < 16; i++) {
h->block_offset[16 + i] =
- h->block_offset[32 + i] = (4 * ((scan8[i] - scan8[0]) & 7) << pixel_shift) + 4 * pic->f.linesize[1] * ((scan8[i] - scan8[0]) >> 3);
+ h->block_offset[32 + i] = (4 * ((scan8[i] - scan8[0]) & 7) << pixel_shift) + 4 * pic->f->linesize[1] * ((scan8[i] - scan8[0]) >> 3);
h->block_offset[48 + 16 + i] =
- h->block_offset[48 + 32 + i] = (4 * ((scan8[i] - scan8[0]) & 7) << pixel_shift) + 8 * pic->f.linesize[1] * ((scan8[i] - scan8[0]) >> 3);
+ h->block_offset[48 + 32 + i] = (4 * ((scan8[i] - scan8[0]) & 7) << pixel_shift) + 8 * pic->f->linesize[1] * ((scan8[i] - scan8[0]) >> 3);
}
/* We mark the current picture as non-reference after allocating it, so
@@ -1460,7 +1460,7 @@ int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl)
* since that can modify h->cur_pic_ptr. */
if (h->first_field) {
av_assert0(h->cur_pic_ptr);
- av_assert0(h->cur_pic_ptr->f.buf[0]);
+ av_assert0(h->cur_pic_ptr->f->buf[0]);
assert(h->cur_pic_ptr->reference != DELAYED_PIC_REF);
/* Mark old field/frame as completed */
@@ -1545,10 +1545,10 @@ int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl)
* is not noticeable by comparison, but it should be fixed. */
if (h->short_ref_count) {
if (prev) {
- av_image_copy(h->short_ref[0]->f.data,
- h->short_ref[0]->f.linesize,
- (const uint8_t **)prev->f.data,
- prev->f.linesize,
+ av_image_copy(h->short_ref[0]->f->data,
+ h->short_ref[0]->f->linesize,
+ (const uint8_t **)prev->f->data,
+ prev->f->linesize,
h->avctx->pix_fmt,
h->mb_width * 16,
h->mb_height * 16);
@@ -1563,7 +1563,7 @@ int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl)
* frame, or to allocate a new one. */
if (h->first_field) {
av_assert0(h->cur_pic_ptr);
- av_assert0(h->cur_pic_ptr->f.buf[0]);
+ av_assert0(h->cur_pic_ptr->f->buf[0]);
assert(h->cur_pic_ptr->reference != DELAYED_PIC_REF);
/* figure out if we have a complementary field pair */
@@ -1833,16 +1833,16 @@ int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl)
for (i = 0; i < 16; i++) {
id_list[i] = 60;
if (j < sl->list_count && i < sl->ref_count[j] &&
- sl->ref_list[j][i].parent->f.buf[0]) {
+ sl->ref_list[j][i].parent->f->buf[0]) {
int k;
- AVBuffer *buf = sl->ref_list[j][i].parent->f.buf[0]->buffer;
+ AVBuffer *buf = sl->ref_list[j][i].parent->f->buf[0]->buffer;
for (k = 0; k < h->short_ref_count; k++)
- if (h->short_ref[k]->f.buf[0]->buffer == buf) {
+ if (h->short_ref[k]->f->buf[0]->buffer == buf) {
id_list[i] = k;
break;
}
for (k = 0; k < h->long_ref_count; k++)
- if (h->long_ref[k] && h->long_ref[k]->f.buf[0]->buffer == buf) {
+ if (h->long_ref[k] && h->long_ref[k]->f->buf[0]->buffer == buf) {
id_list[i] = h->short_ref_count + k;
break;
}
@@ -2161,12 +2161,12 @@ static void loop_filter(const H264Context *h, H264SliceContext *sl, int start_x,
sl->mb_x = mb_x;
sl->mb_y = mb_y;
- dest_y = h->cur_pic.f.data[0] +
+ dest_y = h->cur_pic.f->data[0] +
((mb_x << pixel_shift) + mb_y * sl->linesize) * 16;
- dest_cb = h->cur_pic.f.data[1] +
+ dest_cb = h->cur_pic.f->data[1] +
(mb_x << pixel_shift) * (8 << CHROMA444(h)) +
mb_y * sl->uvlinesize * block_h;
- dest_cr = h->cur_pic.f.data[2] +
+ dest_cr = h->cur_pic.f->data[2] +
(mb_x << pixel_shift) * (8 << CHROMA444(h)) +
mb_y * sl->uvlinesize * block_h;
// FIXME simplify above
@@ -2271,8 +2271,8 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg)
int lf_x_start = sl->mb_x;
int ret;
- sl->linesize = h->cur_pic_ptr->f.linesize[0];
- sl->uvlinesize = h->cur_pic_ptr->f.linesize[1];
+ sl->linesize = h->cur_pic_ptr->f->linesize[0];
+ sl->uvlinesize = h->cur_pic_ptr->f->linesize[1];
ret = alloc_scratch_buffers(sl, sl->linesize);
if (ret < 0)