Commit aafc4c5c authored by lucabe's avatar lucabe

Simplify the code used for assigning video_resample, video_crop, & video_pad


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@5306 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent c4021e60
...@@ -1632,49 +1632,31 @@ static int av_encode(AVFormatContext **output_files, ...@@ -1632,49 +1632,31 @@ static int av_encode(AVFormatContext **output_files,
ost->encoding_needed = 1; ost->encoding_needed = 1;
break; break;
case CODEC_TYPE_VIDEO: case CODEC_TYPE_VIDEO:
if (codec->width == icodec->width && ost->video_crop = ((frame_leftBand + frame_rightBand + frame_topBand + frame_bottomBand) != 0);
codec->height == icodec->height && ost->video_pad = ((frame_padleft + frame_padright + frame_padtop + frame_padbottom) != 0);
frame_topBand == 0 && ost->video_resample = ((codec->width != icodec->width -
frame_bottomBand == 0 && (frame_leftBand + frame_rightBand) +
frame_leftBand == 0 && (frame_padleft + frame_padright)) ||
frame_rightBand == 0 && (codec->height != icodec->height -
frame_padtop == 0 && (frame_topBand + frame_bottomBand) +
frame_padbottom == 0 && (frame_padtop + frame_padbottom)));
frame_padleft == 0 && if (ost->video_crop) {
frame_padright == 0)
{
ost->video_resample = 0;
ost->video_crop = 0;
ost->video_pad = 0;
} else if ((codec->width == icodec->width -
(frame_leftBand + frame_rightBand)) &&
(codec->height == icodec->height -
(frame_topBand + frame_bottomBand)) &&
(frame_rightBand + frame_leftBand + frame_topBand + frame_bottomBand)) {
ost->video_resample = 0;
ost->video_crop = 1;
ost->topBand = frame_topBand; ost->topBand = frame_topBand;
ost->leftBand = frame_leftBand; ost->leftBand = frame_leftBand;
} else if ((codec->width == icodec->width + }
(frame_padleft + frame_padright)) && if (ost->video_pad) {
(codec->height == icodec->height +
(frame_padtop + frame_padbottom)) &&
(frame_padright + frame_padleft + frame_padtop + frame_padbottom)) {
ost->video_resample = 0;
ost->video_crop = 0;
ost->video_pad = 1;
ost->padtop = frame_padtop; ost->padtop = frame_padtop;
ost->padleft = frame_padleft; ost->padleft = frame_padleft;
ost->padbottom = frame_padbottom; ost->padbottom = frame_padbottom;
ost->padright = frame_padright; ost->padright = frame_padright;
if (!ost->video_resample) {
avcodec_get_frame_defaults(&ost->pict_tmp); avcodec_get_frame_defaults(&ost->pict_tmp);
if( avpicture_alloc( (AVPicture*)&ost->pict_tmp, codec->pix_fmt, if( avpicture_alloc( (AVPicture*)&ost->pict_tmp, codec->pix_fmt,
codec->width, codec->height ) ) codec->width, codec->height ) )
goto fail; goto fail;
} else { }
ost->video_resample = 1; }
ost->video_crop = ((frame_leftBand + frame_rightBand + frame_topBand + frame_bottomBand) != 0); if (ost->video_resample) {
ost->video_pad = ((frame_padleft + frame_padright + frame_padtop + frame_padbottom) != 0);
avcodec_get_frame_defaults(&ost->pict_tmp); avcodec_get_frame_defaults(&ost->pict_tmp);
if( avpicture_alloc( (AVPicture*)&ost->pict_tmp, PIX_FMT_YUV420P, if( avpicture_alloc( (AVPicture*)&ost->pict_tmp, PIX_FMT_YUV420P,
codec->width, codec->height ) ) codec->width, codec->height ) )
...@@ -1686,12 +1668,6 @@ static int av_encode(AVFormatContext **output_files, ...@@ -1686,12 +1668,6 @@ static int av_encode(AVFormatContext **output_files,
icodec->width - (frame_leftBand + frame_rightBand), icodec->width - (frame_leftBand + frame_rightBand),
icodec->height - (frame_topBand + frame_bottomBand)); icodec->height - (frame_topBand + frame_bottomBand));
ost->padtop = frame_padtop;
ost->padleft = frame_padleft;
ost->padbottom = frame_padbottom;
ost->padright = frame_padright;
ost->topBand = frame_topBand;
ost->leftBand = frame_leftBand;
} }
ost->encoding_needed = 1; ost->encoding_needed = 1;
ist->decoding_needed = 1; ist->decoding_needed = 1;
......
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