Commit 04f4dbc2 authored by Anton Khirnov's avatar Anton Khirnov

mpegvideo_enc: fix indentation in load_input_picture()

parent 3f47d316
...@@ -948,85 +948,85 @@ static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg) ...@@ -948,85 +948,85 @@ static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg)
} }
} }
if (pic_arg) { if (pic_arg) {
if (encoding_delay && !(s->flags & CODEC_FLAG_INPUT_PRESERVED)) if (encoding_delay && !(s->flags & CODEC_FLAG_INPUT_PRESERVED))
direct = 0; direct = 0;
if (pic_arg->linesize[0] != s->linesize) if (pic_arg->linesize[0] != s->linesize)
direct = 0; direct = 0;
if (pic_arg->linesize[1] != s->uvlinesize) if (pic_arg->linesize[1] != s->uvlinesize)
direct = 0; direct = 0;
if (pic_arg->linesize[2] != s->uvlinesize) if (pic_arg->linesize[2] != s->uvlinesize)
direct = 0; direct = 0;
av_dlog(s->avctx, "%d %d %d %d\n", pic_arg->linesize[0], av_dlog(s->avctx, "%d %d %d %d\n", pic_arg->linesize[0],
pic_arg->linesize[1], s->linesize, s->uvlinesize); pic_arg->linesize[1], s->linesize, s->uvlinesize);
if (direct) { if (direct) {
i = ff_find_unused_picture(s, 1); i = ff_find_unused_picture(s, 1);
if (i < 0) if (i < 0)
return i; return i;
pic = &s->picture[i].f;
pic->reference = 3;
for (i = 0; i < 4; i++) { pic = &s->picture[i].f;
pic->data[i] = pic_arg->data[i]; pic->reference = 3;
pic->linesize[i] = pic_arg->linesize[i];
}
if (ff_alloc_picture(s, (Picture *) pic, 1) < 0) {
return -1;
}
} else {
i = ff_find_unused_picture(s, 0);
if (i < 0)
return i;
pic = &s->picture[i].f; for (i = 0; i < 4; i++) {
pic->reference = 3; pic->data[i] = pic_arg->data[i];
pic->linesize[i] = pic_arg->linesize[i];
}
if (ff_alloc_picture(s, (Picture *) pic, 1) < 0) {
return -1;
}
} else {
i = ff_find_unused_picture(s, 0);
if (i < 0)
return i;
if (ff_alloc_picture(s, (Picture *) pic, 0) < 0) { pic = &s->picture[i].f;
return -1; pic->reference = 3;
}
if (pic->data[0] + INPLACE_OFFSET == pic_arg->data[0] && if (ff_alloc_picture(s, (Picture *) pic, 0) < 0) {
pic->data[1] + INPLACE_OFFSET == pic_arg->data[1] && return -1;
pic->data[2] + INPLACE_OFFSET == pic_arg->data[2]) { }
// empty
} else { if (pic->data[0] + INPLACE_OFFSET == pic_arg->data[0] &&
int h_chroma_shift, v_chroma_shift; pic->data[1] + INPLACE_OFFSET == pic_arg->data[1] &&
av_pix_fmt_get_chroma_sub_sample(s->avctx->pix_fmt, pic->data[2] + INPLACE_OFFSET == pic_arg->data[2]) {
&h_chroma_shift, // empty
&v_chroma_shift); } else {
int h_chroma_shift, v_chroma_shift;
for (i = 0; i < 3; i++) { av_pix_fmt_get_chroma_sub_sample(s->avctx->pix_fmt,
int src_stride = pic_arg->linesize[i]; &h_chroma_shift,
int dst_stride = i ? s->uvlinesize : s->linesize; &v_chroma_shift);
int h_shift = i ? h_chroma_shift : 0;
int v_shift = i ? v_chroma_shift : 0; for (i = 0; i < 3; i++) {
int w = s->width >> h_shift; int src_stride = pic_arg->linesize[i];
int h = s->height >> v_shift; int dst_stride = i ? s->uvlinesize : s->linesize;
uint8_t *src = pic_arg->data[i]; int h_shift = i ? h_chroma_shift : 0;
uint8_t *dst = pic->data[i]; int v_shift = i ? v_chroma_shift : 0;
int w = s->width >> h_shift;
if (!s->avctx->rc_buffer_size) int h = s->height >> v_shift;
dst += INPLACE_OFFSET; uint8_t *src = pic_arg->data[i];
uint8_t *dst = pic->data[i];
if (src_stride == dst_stride)
memcpy(dst, src, src_stride * h); if (!s->avctx->rc_buffer_size)
else { dst += INPLACE_OFFSET;
while (h--) {
memcpy(dst, src, w); if (src_stride == dst_stride)
dst += dst_stride; memcpy(dst, src, src_stride * h);
src += src_stride; else {
while (h--) {
memcpy(dst, src, w);
dst += dst_stride;
src += src_stride;
}
} }
} }
} }
} }
copy_picture_attributes(s, pic, pic_arg);
pic->display_picture_number = display_picture_number;
pic->pts = pts; // we set this here to avoid modifiying pic_arg
} }
copy_picture_attributes(s, pic, pic_arg);
pic->display_picture_number = display_picture_number;
pic->pts = pts; // we set this here to avoid modifiying pic_arg
}
/* shift buffer entries */ /* shift buffer entries */
for (i = 1; i < MAX_PICTURE_COUNT /*s->encoding_delay + 1*/; i++) for (i = 1; i < MAX_PICTURE_COUNT /*s->encoding_delay + 1*/; i++)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment