[vlc-devel] [PATCH] demux: avi: log height as signed value
Francois Cartegnie
fcvlcdev at free.fr
Wed Oct 9 09:53:47 CEST 2019
Le 07/10/2019 à 15:42, Romain Vimont a écrit :
> The height may be "negative" (but still stored as unsigned) when the
> lines are coded from bottom to top.
>
> In that case, print 1920x-1080 instead of 1920x4294966216.
The swapped V plane case is already handled.
So we just need to print the fmt value.
> Ref #22915
> ---
> modules/demux/avi/avi.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c
> index db4659a1b3..2ad30d223f 100644
> --- a/modules/demux/avi/avi.c
> +++ b/modules/demux/avi/avi.c
> @@ -635,10 +635,14 @@ static int Open( vlc_object_t * p_this )
> tk->fmt.video.i_width;
> }
>
> - msg_Dbg( p_demux, "stream[%u] video(%4.4s) %"PRIu32"x%"PRIu32" %dbpp %ffps",
> + /* casting directly from unsigned to signed would be undefined when the MSB is 1 */
> + uint32_t unsigned_height = p_vids->p_bih->biHeight;
> + int sign = unsigned_height <= INT32_MAX ? 1 : -1;
> + int32_t height = sign * (int32_t) (sign * unsigned_height);
> + msg_Dbg( p_demux, "stream[%u] video(%4.4s) %"PRIu32"x%"PRId32" %dbpp %ffps",
> i, (char*)&p_vids->p_bih->biCompression,
> (uint32_t)p_vids->p_bih->biWidth,
> - (uint32_t)p_vids->p_bih->biHeight,
> + height,
> p_vids->p_bih->biBitCount,
> (float)tk->i_rate/(float)tk->i_scale );
> break;
>
--
Francois Cartegnie
VideoLAN - VLC Developer
More information about the vlc-devel
mailing list