mirror of
https://github.com/nyanmisaka/ffmpeg-rockchip.git
synced 2026-01-23 23:21:06 +01:00
HACK: lavu: allow image copy for NV15 and NV20
Signed-off-by: nyanmisaka <nst799610810@gmail.com>
This commit is contained in:
parent
529fe6e12e
commit
c359d00d13
1 changed files with 19 additions and 7 deletions
|
|
@ -341,6 +341,19 @@ int av_image_check_sar(unsigned int w, unsigned int h, AVRational sar)
|
|||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
static void image_copy_plane2(uint8_t *dst, ptrdiff_t dst_linesize,
|
||||
const uint8_t *src, ptrdiff_t src_linesize,
|
||||
ptrdiff_t bytewidth, int height)
|
||||
{
|
||||
if (!dst || !src)
|
||||
return;
|
||||
for (;height > 0; height--) {
|
||||
memcpy(dst, src, bytewidth);
|
||||
dst += dst_linesize;
|
||||
src += src_linesize;
|
||||
}
|
||||
}
|
||||
|
||||
static void image_copy_plane(uint8_t *dst, ptrdiff_t dst_linesize,
|
||||
const uint8_t *src, ptrdiff_t src_linesize,
|
||||
ptrdiff_t bytewidth, int height)
|
||||
|
|
@ -349,11 +362,9 @@ static void image_copy_plane(uint8_t *dst, ptrdiff_t dst_linesize,
|
|||
return;
|
||||
av_assert0(FFABS(src_linesize) >= bytewidth);
|
||||
av_assert0(FFABS(dst_linesize) >= bytewidth);
|
||||
for (;height > 0; height--) {
|
||||
memcpy(dst, src, bytewidth);
|
||||
dst += dst_linesize;
|
||||
src += src_linesize;
|
||||
}
|
||||
image_copy_plane2(dst, dst_linesize,
|
||||
src, src_linesize,
|
||||
bytewidth, height);
|
||||
}
|
||||
|
||||
void av_image_copy_plane_uc_from(uint8_t *dst, ptrdiff_t dst_linesize,
|
||||
|
|
@ -424,7 +435,8 @@ void av_image_copy(uint8_t *const dst_data[4], const int dst_linesizes[4],
|
|||
enum AVPixelFormat pix_fmt, int width, int height)
|
||||
{
|
||||
ptrdiff_t dst_linesizes1[4], src_linesizes1[4];
|
||||
int i;
|
||||
int i, is_nv15_20 = pix_fmt == AV_PIX_FMT_NV15 ||
|
||||
pix_fmt == AV_PIX_FMT_NV20;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
dst_linesizes1[i] = dst_linesizes[i];
|
||||
|
|
@ -432,7 +444,7 @@ void av_image_copy(uint8_t *const dst_data[4], const int dst_linesizes[4],
|
|||
}
|
||||
|
||||
image_copy(dst_data, dst_linesizes1, src_data, src_linesizes1, pix_fmt,
|
||||
width, height, image_copy_plane);
|
||||
width, height, is_nv15_20 ? image_copy_plane2 : image_copy_plane);
|
||||
}
|
||||
|
||||
void av_image_copy_uc_from(uint8_t * const dst_data[4], const ptrdiff_t dst_linesizes[4],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue