[vlc-devel] [PATCH/RFC] transcode: Do not encode if decoder output fourcc is the target fourcc

Rémi Denis-Courmont remi at remlab.net
Tue Jun 10 21:18:39 CEST 2014


Le lundi 9 juin 2014, 23:45:04 Hugo Beauzée-Luyssen a écrit :
> diff --git a/src/misc/picture.c b/src/misc/picture.c
> index 7c6fa6a..544b4ee 100644
> --- a/src/misc/picture.c
> +++ b/src/misc/picture.c
> @@ -459,3 +459,22 @@ unsigned picture_BlendSubpicture(picture_t *dst,
>      }
>      return done;
>  }
> +
> +block_t* picture_ToBlock( const picture_t* pic )
> +{
> +    size_t nbBytes = pic->format.i_width * pic->format.i_height *
> pic->format.i_bits_per_pixel; +
> +    block_t* block = block_Alloc( nbBytes );
> +    if ( unlikely( block == NULL ) )
> +        return NULL;
> +    uint8_t* b = block->p_buffer;
> +    for (unsigned int i = 0; i < pic->i_planes; ++i )
> +    {
> +        const plane_t* p = &pic->p[i];
> +        size_t planeBytes = p->i_lines * p->i_pitch;
> +        memcpy( b, p->p_pixels, planeBytes );
> +        b += planeBytes;
> +    }

That does not (always) match the pitch values expected by the rawvideo 
decoder; in other words, this will break.

And since memory copying is needed anyway, there are no benefits from making a 
special case out of this (instead of adding encoder capability to rawvideo.c 
if actually needed).

-- 
Rémi Denis-Courmont
http://www.remlab.net/




More information about the vlc-devel mailing list