@ -180,6 +180,47 @@ static int nv12ToPlanarWrapper(SwsContext *c, const uint8_t *src[],
return srcSliceH ;
}
static int planarToNv24Wrapper ( SwsContext * c , const uint8_t * src [ ] ,
int srcStride [ ] , int srcSliceY ,
int srcSliceH , uint8_t * dstParam [ ] ,
int dstStride [ ] )
{
uint8_t * dst = dstParam [ 1 ] + dstStride [ 1 ] * srcSliceY ;
copyPlane ( src [ 0 ] , srcStride [ 0 ] , srcSliceY , srcSliceH , c - > srcW ,
dstParam [ 0 ] , dstStride [ 0 ] ) ;
if ( c - > dstFormat = = AV_PIX_FMT_NV24 )
interleaveBytes ( src [ 1 ] , src [ 2 ] , dst , c - > chrSrcW , srcSliceH ,
srcStride [ 1 ] , srcStride [ 2 ] , dstStride [ 1 ] ) ;
else
interleaveBytes ( src [ 2 ] , src [ 1 ] , dst , c - > chrSrcW , srcSliceH ,
srcStride [ 2 ] , srcStride [ 1 ] , dstStride [ 1 ] ) ;
return srcSliceH ;
}
static int nv24ToPlanarWrapper ( SwsContext * c , const uint8_t * src [ ] ,
int srcStride [ ] , int srcSliceY ,
int srcSliceH , uint8_t * dstParam [ ] ,
int dstStride [ ] )
{
uint8_t * dst1 = dstParam [ 1 ] + dstStride [ 1 ] * srcSliceY ;
uint8_t * dst2 = dstParam [ 2 ] + dstStride [ 2 ] * srcSliceY ;
copyPlane ( src [ 0 ] , srcStride [ 0 ] , srcSliceY , srcSliceH , c - > srcW ,
dstParam [ 0 ] , dstStride [ 0 ] ) ;
if ( c - > srcFormat = = AV_PIX_FMT_NV24 )
deinterleaveBytes ( src [ 1 ] , dst1 , dst2 , c - > chrSrcW , srcSliceH ,
srcStride [ 1 ] , dstStride [ 1 ] , dstStride [ 2 ] ) ;
else
deinterleaveBytes ( src [ 1 ] , dst2 , dst1 , c - > chrSrcW , srcSliceH ,
srcStride [ 1 ] , dstStride [ 2 ] , dstStride [ 1 ] ) ;
return srcSliceH ;
}
static int planarToP01xWrapper ( SwsContext * c , const uint8_t * src8 [ ] ,
int srcStride [ ] , int srcSliceY ,
int srcSliceH , uint8_t * dstParam8 [ ] ,
@ -1872,11 +1913,21 @@ void ff_get_unscaled_swscale(SwsContext *c)
( dstFormat = = AV_PIX_FMT_NV12 | | dstFormat = = AV_PIX_FMT_NV21 ) ) {
c - > swscale = planarToNv12Wrapper ;
}
/* yv24_to_nv24 */
if ( ( srcFormat = = AV_PIX_FMT_YUV444P | | srcFormat = = AV_PIX_FMT_YUVA444P ) & &
( dstFormat = = AV_PIX_FMT_NV24 | | dstFormat = = AV_PIX_FMT_NV42 ) ) {
c - > swscale = planarToNv24Wrapper ;
}
/* nv12_to_yv12 */
if ( dstFormat = = AV_PIX_FMT_YUV420P & &
( srcFormat = = AV_PIX_FMT_NV12 | | srcFormat = = AV_PIX_FMT_NV21 ) ) {
c - > swscale = nv12ToPlanarWrapper ;
}
/* nv24_to_yv24 */
if ( dstFormat = = AV_PIX_FMT_YUV444P & &
( srcFormat = = AV_PIX_FMT_NV24 | | srcFormat = = AV_PIX_FMT_NV42 ) ) {
c - > swscale = nv24ToPlanarWrapper ;
}
/* yuv2bgr */
if ( ( srcFormat = = AV_PIX_FMT_YUV420P | | srcFormat = = AV_PIX_FMT_YUV422P | |
srcFormat = = AV_PIX_FMT_YUVA420P ) & & isAnyRGB ( dstFormat ) & &