Commit ee870491 authored by Anton Khirnov's avatar Anton Khirnov

mpegvideo: reindent

parent 19cac8e3
......@@ -1515,26 +1515,26 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
s->mb_skipped = 0;
/* 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);
}
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]);
}
/* 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);
......@@ -1600,79 +1600,79 @@ 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];
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], 0,
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]);
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->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;
}
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];
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);
s->last_picture_ptr = &s->picture[i];
if (ff_alloc_picture(s, s->last_picture_ptr, 0) < 0) {
s->last_picture_ptr = NULL;
return -1;
}
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;
memset(s->last_picture_ptr->f.data[0], 0,
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]);
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;
}
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;
s->next_picture_ptr = &s->picture[i];
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 (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;
......
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