[vlc-commits] image: remove always true test
Steve Lhomme
git at videolan.org
Mon Jan 18 08:08:28 UTC 2021
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Jan 13 09:03:30 2021 +0100| [ff95a0e1d00f9f10be6fd2c6f4dd93798a323d5c] | committer: Steve Lhomme
image: remove always true test
At this stage the whole p_enc->fmt_out.video is initialized to 0 so the test
will always pass. Later the p_enc->fmt_out.video width/height is even set to
the input values.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ff95a0e1d00f9f10be6fd2c6f4dd93798a323d5c
---
src/misc/image.c | 41 ++++++++++++-----------------------------
1 file changed, 12 insertions(+), 29 deletions(-)
diff --git a/src/misc/image.c b/src/misc/image.c
index 034b0a27d8..3b6cece47e 100644
--- a/src/misc/image.c
+++ b/src/misc/image.c
@@ -718,38 +718,21 @@ static encoder_t *CreateEncoder( vlc_object_t *p_this, const video_format_t *fmt
p_enc->p_module = NULL;
es_format_InitFromVideo( &p_enc->fmt_in, fmt_in );
- if( p_enc->fmt_in.video.i_visible_width == 0 ||
- p_enc->fmt_in.video.i_visible_height == 0 ||
- p_enc->fmt_out.video.i_visible_width == 0 ||
- p_enc->fmt_out.video.i_visible_height == 0 )
+ if( fmt_out->i_width > 0 && fmt_out->i_height > 0 )
{
- if( fmt_out->i_width > 0 && fmt_out->i_height > 0 )
- {
- p_enc->fmt_in.video.i_width = fmt_out->i_width;
- p_enc->fmt_in.video.i_height = fmt_out->i_height;
+ p_enc->fmt_in.video.i_width = fmt_out->i_width;
+ p_enc->fmt_in.video.i_height = fmt_out->i_height;
- if( fmt_out->i_visible_width > 0 &&
- fmt_out->i_visible_height > 0 )
- {
- p_enc->fmt_in.video.i_visible_width = fmt_out->i_visible_width;
- p_enc->fmt_in.video.i_visible_height = fmt_out->i_visible_height;
- }
- else
- {
- p_enc->fmt_in.video.i_visible_width = fmt_out->i_width;
- p_enc->fmt_in.video.i_visible_height = fmt_out->i_height;
- }
+ if( fmt_out->i_visible_width > 0 && fmt_out->i_visible_height > 0 )
+ {
+ p_enc->fmt_in.video.i_visible_width = fmt_out->i_visible_width;
+ p_enc->fmt_in.video.i_visible_height = fmt_out->i_visible_height;
+ }
+ else
+ {
+ p_enc->fmt_in.video.i_visible_width = fmt_out->i_width;
+ p_enc->fmt_in.video.i_visible_height = fmt_out->i_height;
}
- } else if( fmt_out->i_sar_num && fmt_out->i_sar_den &&
- fmt_out->i_sar_num * fmt_in->i_sar_den !=
- fmt_out->i_sar_den * fmt_in->i_sar_num )
- {
- p_enc->fmt_in.video.i_width =
- fmt_in->i_sar_num * (int64_t)fmt_out->i_sar_den * fmt_in->i_width /
- fmt_in->i_sar_den / fmt_out->i_sar_num;
- p_enc->fmt_in.video.i_visible_width =
- fmt_in->i_sar_num * (int64_t)fmt_out->i_sar_den *
- fmt_in->i_visible_width / fmt_in->i_sar_den / fmt_out->i_sar_num;
}
p_enc->fmt_in.video.i_frame_rate = 25;
More information about the vlc-commits
mailing list