aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mpegvideo_enc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-01-26 15:53:58 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-01-26 15:53:58 +0100
commit5cb0782b952f5e04fd686d31ed5754e235cc2742 (patch)
treec63b35f4cfb2b3c83d246b9748491fa0a8c4a148 /libavcodec/mpegvideo_enc.c
parentc46943ec19df5077610518e3dae6184414ef435d (diff)
parent04f4dbc2fa7c17c915300cade64947531124100e (diff)
downloadandroid_external_ffmpeg-5cb0782b952f5e04fd686d31ed5754e235cc2742.tar.gz
android_external_ffmpeg-5cb0782b952f5e04fd686d31ed5754e235cc2742.tar.bz2
android_external_ffmpeg-5cb0782b952f5e04fd686d31ed5754e235cc2742.zip
Merge remote-tracking branch 'qatar/master'
* qatar/master: mpegvideo_enc: fix indentation in load_input_picture() Conflicts: libavcodec/mpegvideo_enc.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mpegvideo_enc.c')
-rw-r--r--libavcodec/mpegvideo_enc.c142
1 files changed, 72 insertions, 70 deletions
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index e461c71131..11607d22c8 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -1047,87 +1047,89 @@ static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg)
}
}
- if (pic_arg) {
- if (encoding_delay && !(s->flags & CODEC_FLAG_INPUT_PRESERVED))
- direct = 0;
- if (pic_arg->linesize[0] != s->linesize)
- direct = 0;
- if (pic_arg->linesize[1] != s->uvlinesize)
- direct = 0;
- if (pic_arg->linesize[2] != s->uvlinesize)
- direct = 0;
-
- av_dlog(s->avctx, "%d %d %d %d\n", pic_arg->linesize[0],
- pic_arg->linesize[1], s->linesize, s->uvlinesize);
-
- if (direct) {
- i = ff_find_unused_picture(s, 1);
- if (i < 0)
- return i;
-
- pic = &s->picture[i].f;
- pic->reference = 3;
+ if (pic_arg) {
+ if (encoding_delay && !(s->flags & CODEC_FLAG_INPUT_PRESERVED))
+ direct = 0;
+ if (pic_arg->linesize[0] != s->linesize)
+ direct = 0;
+ if (pic_arg->linesize[1] != s->uvlinesize)
+ direct = 0;
+ if (pic_arg->linesize[2] != s->uvlinesize)
+ direct = 0;
+
+ av_dlog(s->avctx, "%d %d %d %d\n", pic_arg->linesize[0],
+ pic_arg->linesize[1], s->linesize, s->uvlinesize);
+
+ if (direct) {
+ i = ff_find_unused_picture(s, 1);
+ if (i < 0)
+ return i;
- for (i = 0; i < 4; i++) {
- 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;
+ pic = &s->picture[i].f;
+ pic->reference = 3;
- pic = &s->picture[i].f;
- pic->reference = 3;
+ for (i = 0; i < 4; i++) {
+ 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) {
- return -1;
- }
+ pic = &s->picture[i].f;
+ pic->reference = 3;
- if (pic->data[0] + INPLACE_OFFSET == pic_arg->data[0] &&
- pic->data[1] + INPLACE_OFFSET == pic_arg->data[1] &&
- pic->data[2] + INPLACE_OFFSET == pic_arg->data[2]) {
- // empty
- } else {
- int h_chroma_shift, v_chroma_shift;
- avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &h_chroma_shift, &v_chroma_shift);
-
- for (i = 0; i < 3; i++) {
- int src_stride = pic_arg->linesize[i];
- int dst_stride = i ? s->uvlinesize : s->linesize;
- int h_shift = i ? h_chroma_shift : 0;
- int v_shift = i ? v_chroma_shift : 0;
- int w = s->width >> h_shift;
- int h = s->height >> v_shift;
- uint8_t *src = pic_arg->data[i];
- uint8_t *dst = pic->data[i];
-
- if(s->codec_id == AV_CODEC_ID_AMV && !(s->avctx->flags & CODEC_FLAG_EMU_EDGE)){
- h= ((s->height+15)/16*16)>>v_shift;
- }
+ if (ff_alloc_picture(s, (Picture *) pic, 0) < 0) {
+ return -1;
+ }
+
+ if (pic->data[0] + INPLACE_OFFSET == pic_arg->data[0] &&
+ pic->data[1] + INPLACE_OFFSET == pic_arg->data[1] &&
+ pic->data[2] + INPLACE_OFFSET == pic_arg->data[2]) {
+ // empty
+ } else {
+ int h_chroma_shift, v_chroma_shift;
+ av_pix_fmt_get_chroma_sub_sample(s->avctx->pix_fmt,
+ &h_chroma_shift,
+ &v_chroma_shift);
+
+ for (i = 0; i < 3; i++) {
+ int src_stride = pic_arg->linesize[i];
+ int dst_stride = i ? s->uvlinesize : s->linesize;
+ int h_shift = i ? h_chroma_shift : 0;
+ int v_shift = i ? v_chroma_shift : 0;
+ int w = s->width >> h_shift;
+ int h = s->height >> v_shift;
+ uint8_t *src = pic_arg->data[i];
+ uint8_t *dst = pic->data[i];
+
+ if (s->codec_id == AV_CODEC_ID_AMV && !(s->avctx->flags & CODEC_FLAG_EMU_EDGE)) {
+ h = ((s->height + 15)/16*16) >> v_shift;
+ }
- if (!s->avctx->rc_buffer_size)
- dst += INPLACE_OFFSET;
+ if (!s->avctx->rc_buffer_size)
+ dst += INPLACE_OFFSET;
- if (src_stride == dst_stride)
- memcpy(dst, src, src_stride * h);
- else {
- while (h--) {
- memcpy(dst, src, w);
- dst += dst_stride;
- src += src_stride;
+ if (src_stride == dst_stride)
+ memcpy(dst, src, src_stride * h);
+ 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 */
for (i = 1; i < MAX_PICTURE_COUNT /*s->encoding_delay + 1*/; i++)