summaryrefslogtreecommitdiff
path: root/libavcodec/mpegvideo.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-03-13 13:08:04 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-03-13 13:08:04 +0100
commitdf4517106a3ca494bbdd9c42a5eae1f74f8c3ad3 (patch)
tree744c89592964f187f1a8f460f1884f0218770fcd /libavcodec/mpegvideo.c
parentf45fdb123f39bf7341731aa2e381d7f0f623db70 (diff)
parentee8704916de79158da8a48a9ea5be819e83d23ba (diff)
Merge commit 'ee8704916de79158da8a48a9ea5be819e83d23ba'
* commit 'ee8704916de79158da8a48a9ea5be819e83d23ba': mpegvideo: reindent Conflicts: libavcodec/mpegvideo.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mpegvideo.c')
-rw-r--r--libavcodec/mpegvideo.c187
1 files changed, 94 insertions, 93 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index c4ead4be20..13e68d806d 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -1531,26 +1531,26 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
}
/* mark & release old frames */
- if (s->pict_type != AV_PICTURE_TYPE_B && s->last_picture_ptr &&
- s->last_picture_ptr != s->next_picture_ptr &&
- s->last_picture_ptr->f.data[0]) {
- ff_mpeg_unref_picture(s, s->last_picture_ptr);
- }
-
- /* release forgotten pictures */
- /* if (mpeg124/h263) */
- if (!s->encoding) {
- for (i = 0; i < MAX_PICTURE_COUNT; i++) {
- if (&s->picture[i] != s->last_picture_ptr &&
- &s->picture[i] != s->next_picture_ptr &&
- s->picture[i].reference && !s->picture[i].needs_realloc) {
- if (!(avctx->active_thread_type & FF_THREAD_FRAME))
- av_log(avctx, AV_LOG_ERROR,
- "releasing zombie picture\n");
- ff_mpeg_unref_picture(s, &s->picture[i]);
- }
+ if (s->pict_type != AV_PICTURE_TYPE_B && s->last_picture_ptr &&
+ s->last_picture_ptr != s->next_picture_ptr &&
+ s->last_picture_ptr->f.data[0]) {
+ ff_mpeg_unref_picture(s, s->last_picture_ptr);
+ }
+
+ /* release forgotten pictures */
+ /* if (mpeg124/h263) */
+ if (!s->encoding) {
+ for (i = 0; i < MAX_PICTURE_COUNT; i++) {
+ if (&s->picture[i] != s->last_picture_ptr &&
+ &s->picture[i] != s->next_picture_ptr &&
+ s->picture[i].reference && !s->picture[i].needs_realloc) {
+ if (!(avctx->active_thread_type & FF_THREAD_FRAME))
+ av_log(avctx, AV_LOG_ERROR,
+ "releasing zombie picture\n");
+ ff_mpeg_unref_picture(s, &s->picture[i]);
}
}
+ }
if (!s->encoding) {
ff_release_unused_pictures(s, 1);
@@ -1616,89 +1616,90 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
s->current_picture_ptr ? s->current_picture_ptr->f.data[0] : NULL,
s->pict_type, s->droppable);
- if ((s->last_picture_ptr == NULL ||
- s->last_picture_ptr->f.data[0] == NULL) &&
- (s->pict_type != AV_PICTURE_TYPE_I ||
- s->picture_structure != PICT_FRAME)) {
- int h_chroma_shift, v_chroma_shift;
- av_pix_fmt_get_chroma_sub_sample(s->avctx->pix_fmt,
- &h_chroma_shift, &v_chroma_shift);
- if (s->pict_type != AV_PICTURE_TYPE_I)
- av_log(avctx, AV_LOG_ERROR,
- "warning: first frame is no keyframe\n");
- else if (s->picture_structure != PICT_FRAME)
- av_log(avctx, AV_LOG_INFO,
- "allocate dummy last picture for field based first keyframe\n");
-
- /* Allocate a dummy frame */
- i = ff_find_unused_picture(s, 0);
- if (i < 0) {
- av_log(s->avctx, AV_LOG_ERROR, "no frame buffer available\n");
- return i;
- }
- s->last_picture_ptr = &s->picture[i];
- s->last_picture_ptr->f.key_frame = 0;
- if (ff_alloc_picture(s, s->last_picture_ptr, 0) < 0) {
- s->last_picture_ptr = NULL;
- return -1;
- }
+ if ((s->last_picture_ptr == NULL ||
+ s->last_picture_ptr->f.data[0] == NULL) &&
+ (s->pict_type != AV_PICTURE_TYPE_I ||
+ s->picture_structure != PICT_FRAME)) {
+ int h_chroma_shift, v_chroma_shift;
+ av_pix_fmt_get_chroma_sub_sample(s->avctx->pix_fmt,
+ &h_chroma_shift, &v_chroma_shift);
+ if (s->pict_type != AV_PICTURE_TYPE_I)
+ av_log(avctx, AV_LOG_ERROR,
+ "warning: first frame is no keyframe\n");
+ else if (s->picture_structure != PICT_FRAME)
+ av_log(avctx, AV_LOG_INFO,
+ "allocate dummy last picture for field based first keyframe\n");
+
+ /* Allocate a dummy frame */
+ i = ff_find_unused_picture(s, 0);
+ if (i < 0) {
+ av_log(s->avctx, AV_LOG_ERROR, "no frame buffer available\n");
+ return i;
+ }
+ s->last_picture_ptr = &s->picture[i];
+ s->last_picture_ptr->f.key_frame = 0;
+ if (ff_alloc_picture(s, s->last_picture_ptr, 0) < 0) {
+ s->last_picture_ptr = NULL;
+ return -1;
+ }
- memset(s->last_picture_ptr->f.data[0], 0x80,
- avctx->height * s->last_picture_ptr->f.linesize[0]);
- memset(s->last_picture_ptr->f.data[1], 0x80,
- (avctx->height >> v_chroma_shift) *
- s->last_picture_ptr->f.linesize[1]);
- memset(s->last_picture_ptr->f.data[2], 0x80,
- (avctx->height >> v_chroma_shift) *
- s->last_picture_ptr->f.linesize[2]);
-
- if(s->codec_id == AV_CODEC_ID_FLV1 || s->codec_id == AV_CODEC_ID_H263){
- for(i=0; i<avctx->height; i++)
- memset(s->last_picture_ptr->f.data[0] + s->last_picture_ptr->f.linesize[0]*i, 16, avctx->width);
- }
- ff_thread_report_progress(&s->last_picture_ptr->tf, INT_MAX, 0);
- ff_thread_report_progress(&s->last_picture_ptr->tf, INT_MAX, 1);
- }
- if ((s->next_picture_ptr == NULL ||
- s->next_picture_ptr->f.data[0] == NULL) &&
- s->pict_type == AV_PICTURE_TYPE_B) {
- /* Allocate a dummy frame */
- i = ff_find_unused_picture(s, 0);
- if (i < 0) {
- av_log(s->avctx, AV_LOG_ERROR, "no frame buffer available\n");
- return i;
- }
- s->next_picture_ptr = &s->picture[i];
- s->next_picture_ptr->f.key_frame = 0;
- if (ff_alloc_picture(s, s->next_picture_ptr, 0) < 0) {
- s->next_picture_ptr = NULL;
- return -1;
- }
- ff_thread_report_progress(&s->next_picture_ptr->tf, INT_MAX, 0);
- ff_thread_report_progress(&s->next_picture_ptr->tf, INT_MAX, 1);
+ memset(s->last_picture_ptr->f.data[0], 0x80,
+ avctx->height * s->last_picture_ptr->f.linesize[0]);
+ memset(s->last_picture_ptr->f.data[1], 0x80,
+ (avctx->height >> v_chroma_shift) *
+ s->last_picture_ptr->f.linesize[1]);
+ memset(s->last_picture_ptr->f.data[2], 0x80,
+ (avctx->height >> v_chroma_shift) *
+ s->last_picture_ptr->f.linesize[2]);
+
+ if(s->codec_id == AV_CODEC_ID_FLV1 || s->codec_id == AV_CODEC_ID_H263){
+ for(i=0; i<avctx->height; i++)
+ memset(s->last_picture_ptr->f.data[0] + s->last_picture_ptr->f.linesize[0]*i, 16, avctx->width);
+ }
+
+ ff_thread_report_progress(&s->last_picture_ptr->tf, INT_MAX, 0);
+ ff_thread_report_progress(&s->last_picture_ptr->tf, INT_MAX, 1);
+ }
+ if ((s->next_picture_ptr == NULL ||
+ s->next_picture_ptr->f.data[0] == NULL) &&
+ s->pict_type == AV_PICTURE_TYPE_B) {
+ /* Allocate a dummy frame */
+ i = ff_find_unused_picture(s, 0);
+ if (i < 0) {
+ av_log(s->avctx, AV_LOG_ERROR, "no frame buffer available\n");
+ return i;
+ }
+ s->next_picture_ptr = &s->picture[i];
+ s->next_picture_ptr->f.key_frame = 0;
+ if (ff_alloc_picture(s, s->next_picture_ptr, 0) < 0) {
+ s->next_picture_ptr = NULL;
+ return -1;
}
+ ff_thread_report_progress(&s->next_picture_ptr->tf, INT_MAX, 0);
+ ff_thread_report_progress(&s->next_picture_ptr->tf, INT_MAX, 1);
+ }
#if 0 // BUFREF-FIXME
memset(s->last_picture.f.data, 0, sizeof(s->last_picture.f.data));
memset(s->next_picture.f.data, 0, sizeof(s->next_picture.f.data));
#endif
- if (s->last_picture_ptr) {
- ff_mpeg_unref_picture(s, &s->last_picture);
- if (s->last_picture_ptr->f.data[0] &&
- (ret = ff_mpeg_ref_picture(s, &s->last_picture,
- s->last_picture_ptr)) < 0)
- return ret;
- }
- if (s->next_picture_ptr) {
- ff_mpeg_unref_picture(s, &s->next_picture);
- if (s->next_picture_ptr->f.data[0] &&
- (ret = ff_mpeg_ref_picture(s, &s->next_picture,
- s->next_picture_ptr)) < 0)
- return ret;
- }
+ if (s->last_picture_ptr) {
+ ff_mpeg_unref_picture(s, &s->last_picture);
+ if (s->last_picture_ptr->f.data[0] &&
+ (ret = ff_mpeg_ref_picture(s, &s->last_picture,
+ s->last_picture_ptr)) < 0)
+ return ret;
+ }
+ if (s->next_picture_ptr) {
+ ff_mpeg_unref_picture(s, &s->next_picture);
+ if (s->next_picture_ptr->f.data[0] &&
+ (ret = ff_mpeg_ref_picture(s, &s->next_picture,
+ s->next_picture_ptr)) < 0)
+ return ret;
+ }
- assert(s->pict_type == AV_PICTURE_TYPE_I || (s->last_picture_ptr &&
- s->last_picture_ptr->f.data[0]));
+ assert(s->pict_type == AV_PICTURE_TYPE_I || (s->last_picture_ptr &&
+ s->last_picture_ptr->f.data[0]));
if (s->picture_structure!= PICT_FRAME) {
int i;