[vlc-devel] [vlc-commits] rawvideo: fix the picth/line computation for odd lines/heights

Tristan Matthews tmatth at videolan.org
Tue Apr 17 17:44:40 CEST 2018


Hi,

On Tue, Apr 17, 2018 at 10:13 AM, Steve Lhomme <git at videolan.org> wrote:
> vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Apr 17 16:10:52 2018 +0200| [9d12c0827930eb023db54570b2cc9299594c6e04] | committer: Steve Lhomme
>
> rawvideo: fix the picth/line computation for odd lines/heights
>
> Fixes #20303

This does fix playback, however transcoding fails as there is now a
mismatch between the frame_size (provided by the rawvid demuxer) and
the value of p_block->i_buffer. I get this warning for every frame and
each block is rejected:

rawvideo decoder warning: invalid frame size (37800 < 37872)
from:
http://git.videolan.org/?p=vlc.git;a=blob;f=modules/codec/rawvideo.c#l184

So this probably needs an update as well:
http://git.videolan.org/?p=vlc.git;a=blob;f=modules/demux/rawvid.c;h=60886ae6de9fc151a81439318ab78449cf3bdae7;hb=HEAD#l352

Best,
Tristan

>
>> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9d12c0827930eb023db54570b2cc9299594c6e04
> ---
>
>  modules/codec/rawvideo.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/modules/codec/rawvideo.c b/modules/codec/rawvideo.c
> index b616ddfdd4..e98061dc60 100644
> --- a/modules/codec/rawvideo.c
> +++ b/modules/codec/rawvideo.c
> @@ -116,10 +116,10 @@ static int OpenCommon( decoder_t *p_dec )
>
>      for( unsigned i = 0; i < dsc->plane_count; i++ )
>      {
> -        unsigned pitch = p_dec->fmt_in.video.i_width * dsc->pixel_size
> -                         * dsc->p[i].w.num / dsc->p[i].w.den;
> -        unsigned lines = p_dec->fmt_in.video.i_height
> -                         * dsc->p[i].h.num / dsc->p[i].h.den;
> +        unsigned pitch = ((p_dec->fmt_in.video.i_width + (dsc->p[i].w.den - 1)) / dsc->p[i].w.den)
> +                         * dsc->p[i].w.num * dsc->pixel_size;
> +        unsigned lines = ((p_dec->fmt_in.video.i_height + (dsc->p[i].h.den - 1)) / dsc->p[i].h.den)
> +                         * dsc->p[i].h.num;
>
>          p_sys->pitches[i] = pitch;
>          p_sys->lines[i] = lines;
>
> _______________________________________________
> vlc-commits mailing list
> vlc-commits at videolan.org
> https://mailman.videolan.org/listinfo/vlc-commits


More information about the vlc-devel mailing list