[Ffmpeg-devel] Enforcing "Image Size Must Be Even" rules
Rick Sayre
whorfin
Fri Jul 21 01:14:39 CEST 2006
Mike Melanson wrote:
[...]
> I don't have any comments on your patch other than to advise you to use
> unified format (specify '-u'). Others might pay attention to it then.
>
Fair enough.
--- ffmpeg.c 2006-07-19 18:34:27-07 1.1
+++ ffmpeg.c 2006-07-20 13:06:05-07 1.3
@@ -2201,10 +2201,6 @@
fprintf(stderr, "Incorrect top crop size\n");
exit(1);
}
- if ((frame_topBand % 2) != 0) {
- fprintf(stderr, "Top crop size must be a multiple of 2\n");
- exit(1);
- }
if ((frame_topBand) >= frame_height){
fprintf(stderr, "Vertical crop dimensions are outside the
range of the original image.\nRemember to crop first and scale second.\n");
exit(1);
@@ -2219,10 +2215,6 @@
fprintf(stderr, "Incorrect bottom crop size\n");
exit(1);
}
- if ((frame_bottomBand % 2) != 0) {
- fprintf(stderr, "Bottom crop size must be a multiple of 2\n");
- exit(1);
- }
if ((frame_bottomBand) >= frame_height){
fprintf(stderr, "Vertical crop dimensions are outside the
range of the original image.\nRemember to crop first and scale second.\n");
exit(1);
@@ -2237,10 +2229,6 @@
fprintf(stderr, "Incorrect left crop size\n");
exit(1);
}
- if ((frame_leftBand % 2) != 0) {
- fprintf(stderr, "Left crop size must be a multiple of 2\n");
- exit(1);
- }
if ((frame_leftBand) >= frame_width){
fprintf(stderr, "Horizontal crop dimensions are outside the
range of the original image.\nRemember to crop first and scale second.\n");
exit(1);
@@ -2255,10 +2243,6 @@
fprintf(stderr, "Incorrect right crop size\n");
exit(1);
}
- if ((frame_rightBand % 2) != 0) {
- fprintf(stderr, "Right crop size must be a multiple of 2\n");
- exit(1);
- }
if ((frame_rightBand) >= frame_width){
fprintf(stderr, "Horizontal crop dimensions are outside the
range of the original image.\nRemember to crop first and scale second.\n");
exit(1);
@@ -2272,10 +2256,6 @@
fprintf(stderr, "Incorrect frame size\n");
exit(1);
}
- if ((frame_width % 2) != 0 || (frame_height % 2) != 0) {
- fprintf(stderr, "Frame size must be a multiple of 2\n");
- exit(1);
- }
}
@@ -2317,10 +2297,6 @@
fprintf(stderr, "Incorrect top pad size\n");
exit(1);
}
- if ((frame_padtop % 2) != 0) {
- fprintf(stderr, "Top pad size must be a multiple of 2\n");
- exit(1);
- }
}
static void opt_frame_pad_bottom(const char *arg)
@@ -2330,10 +2306,6 @@
fprintf(stderr, "Incorrect bottom pad size\n");
exit(1);
}
- if ((frame_padbottom % 2) != 0) {
- fprintf(stderr, "Bottom pad size must be a multiple of 2\n");
- exit(1);
- }
}
@@ -2344,10 +2316,6 @@
fprintf(stderr, "Incorrect left pad size\n");
exit(1);
}
- if ((frame_padleft % 2) != 0) {
- fprintf(stderr, "Left pad size must be a multiple of 2\n");
- exit(1);
- }
}
@@ -2358,10 +2326,6 @@
fprintf(stderr, "Incorrect right pad size\n");
exit(1);
}
- if ((frame_padright % 2) != 0) {
- fprintf(stderr, "Right pad size must be a multiple of 2\n");
- exit(1);
- }
}
@@ -3045,6 +3009,14 @@
video_enc->width = frame_width + frame_padright + frame_padleft;
video_enc->height = frame_height + frame_padtop + frame_padbottom;
+
+ if ((video_enc->width % 2) != 0 || (video_enc->height % 2) != 0) {
+ fprintf(stderr,
+ "Error for %s: Resultant size [%dx%d] not a multiple of
2\n",
+ oc->filename, video_enc->width, video_enc->height);
+ exit(1);
+ }
+
video_enc->sample_aspect_ratio =
av_d2q(frame_aspect_ratio*frame_height/frame_width, 255);
video_enc->pix_fmt = frame_pix_fmt;
More information about the ffmpeg-devel
mailing list