mirror of https://git.ffmpeg.org/ffmpeg.git
hwcontext_vaapi: allow transfers to/from any size of sw frame
The hw frame used as reference has an attached size but it need not match the actual size of the surface, so enforcing that the sw frame used in copying matches its size exactly is not useful. Signed-off-by: Anton Khirnov <anton@khirnov.net>
This commit is contained in:
parent
c3f113d584
commit
f62bb216ac
|
@ -770,6 +770,9 @@ static int vaapi_transfer_data_from(AVHWFramesContext *hwfc,
|
||||||
AVFrame *map;
|
AVFrame *map;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
if (dst->width > hwfc->width || dst->height > hwfc->height)
|
||||||
|
return AVERROR(EINVAL);
|
||||||
|
|
||||||
map = av_frame_alloc();
|
map = av_frame_alloc();
|
||||||
if (!map)
|
if (!map)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
|
@ -779,6 +782,9 @@ static int vaapi_transfer_data_from(AVHWFramesContext *hwfc,
|
||||||
if (err)
|
if (err)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
map->width = dst->width;
|
||||||
|
map->height = dst->height;
|
||||||
|
|
||||||
err = av_frame_copy(dst, map);
|
err = av_frame_copy(dst, map);
|
||||||
if (err)
|
if (err)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
@ -795,6 +801,9 @@ static int vaapi_transfer_data_to(AVHWFramesContext *hwfc,
|
||||||
AVFrame *map;
|
AVFrame *map;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
if (src->width > hwfc->width || src->height > hwfc->height)
|
||||||
|
return AVERROR(EINVAL);
|
||||||
|
|
||||||
map = av_frame_alloc();
|
map = av_frame_alloc();
|
||||||
if (!map)
|
if (!map)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
|
@ -804,6 +813,9 @@ static int vaapi_transfer_data_to(AVHWFramesContext *hwfc,
|
||||||
if (err)
|
if (err)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
map->width = src->width;
|
||||||
|
map->height = src->height;
|
||||||
|
|
||||||
err = av_frame_copy(map, src);
|
err = av_frame_copy(map, src);
|
||||||
if (err)
|
if (err)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
Loading…
Reference in New Issue