[vlc-devel] [PATCH] chroma: support NV12 plane copy to I420 and NV12 planes
Steve Lhomme
robux4 at videolabs.io
Mon Apr 20 12:10:09 CEST 2015
--
in addition to the current YV12
---
modules/video_chroma/copy.c | 40 +++++++++++++++++++++++++++++++---------
1 file changed, 31 insertions(+), 9 deletions(-)
diff --git a/modules/video_chroma/copy.c b/modules/video_chroma/copy.c
index cc98c92..2ddf9ef 100644
--- a/modules/video_chroma/copy.c
+++ b/modules/video_chroma/copy.c
@@ -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);
asm volatile ("emms");
}
@@ -394,10 +406,20 @@ void CopyFromNv12(picture_t *dst, uint8_t *src[2], size_t src_pitch[2],
CopyPlane(dst->p[0].p_pixels, dst->p[0].i_pitch,
src[0], src_pitch[0],
width, height);
- 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],
- width/2, height/2);
+ if( dst->format.i_chroma == VLC_CODEC_YV12 )
+ 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],
+ width/2, height/2);
+ else if( dst->format.i_chroma = VLC_CODEC_I420 )
+ 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],
+ width/2, height/2);
+ else if( dst->format.i_chroma == VLC_CODEC_NV12 )
+ CopyPlane(dst->p[1].p_pixels, dst->p[1].i_pitch,
+ src[1], src_pitch[1],
+ width, height/2);
}
void CopyFromYv12(picture_t *dst, uint8_t *src[3], size_t src_pitch[3],
--
2.3.0
More information about the vlc-devel
mailing list