[vlc-devel] [PATCH] chroma: support NV12 plane copy to I420 and NV12 planes

Steve Lhomme robux4 at videolabs.io
Thu Apr 23 08:36:17 CEST 2015


On Wed, Apr 22, 2015 at 6:10 PM, Jean-Baptiste Kempf <jb at videolan.org> wrote:
> On 20 Apr, Steve Lhomme wrote :
>> @@ -326,11 +326,23 @@ static void SSE_CopyFromNv12(picture_t *dst,
>>                    src[0], src_pitch[0],
>>                    cache->buffer, cache->size,
>>                    width, height, cpu);
>> -    SSE_SplitPlanes(dst->p[2].p_pixels, dst->p[2].i_pitch,
>> -                    dst->p[1].p_pixels, dst->p[1].i_pitch,
>> -                    src[1], src_pitch[1],
>> -                    cache->buffer, cache->size,
>> -                    (width+1)/2, (height+1)/2, cpu);
>> +    if( dst->format.i_chroma == VLC_CODEC_YV12 )
>> +        SSE_SplitPlanes(dst->p[2].p_pixels, dst->p[2].i_pitch,
>> +                        dst->p[1].p_pixels, dst->p[1].i_pitch,
>> +                        src[1], src_pitch[1],
>> +                        cache->buffer, cache->size,
>> +                        (width+1)/2, (height+1)/2, cpu);
>> +    else if( dst->format.i_chroma == VLC_CODEC_I420 )
>> +        SSE_SplitPlanes(dst->p[1].p_pixels, dst->p[1].i_pitch,
>> +                        dst->p[2].p_pixels, dst->p[2].i_pitch,
>> +                        src[1], src_pitch[1],
>> +                        cache->buffer, cache->size,
>> +                        (width+1)/2, (height+1)/2, cpu);
>> +    else if( dst->format.i_chroma == VLC_CODEC_NV12 )
>> +        SSE_CopyPlane(dst->p[1].p_pixels, dst->p[1].i_pitch,
>> +                      src[1], src_pitch[1],
>> +                      cache->buffer, cache->size,
>> +                      width, height/2, cpu);
>
> Then, this is incorrect. The name is from "Nv12".
>
> See
> https://mailman.videolan.org/pipermail/vlc-devel/2015-February/101221.html


I don't understand. The values are incorrect ? I just double checked
and it seems OK. The second plane contains U and V together. For other
formats they need to be split but from NV12 planes to NV12 planes they
can be copied as one combined plane. Hence width not divided by 2.

Or should there be CopyFromNv12ToI420, CopyFromNv12ToYV12 and
CopyFromNv12ToNv12 ? The caller being responsible for the check.



More information about the vlc-devel mailing list