mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-13 21:28:01 +02:00
avfilter/overlay_cuda: add hsub and vsub compute x and y positions
fix problem when set x to odd number in nv12 by cuda test step: 1. ffmpeg -f lavfi testsrc2=s=176x144 -pix_fmt nv12 -t 1 output_overlay.yuv 2. ffmpeg -f lavfi testsrc2=s=352x288 -pix_fmt nv12 -t 1 output_main.yuv before this patch: overlay_cuda=x=0:y=0 will right, overlay_cuda=x=3:y=0 will wrong, both will right after patch. Signed-off-by: Steven Liu <liuqi05@kuaishou.com> Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
This commit is contained in:
parent
8bcce5673a
commit
282b9f4cba
@ -145,11 +145,16 @@ static int overlay_cuda_blend(FFFrameSync *fs)
|
|||||||
AVFilterContext *avctx = fs->parent;
|
AVFilterContext *avctx = fs->parent;
|
||||||
OverlayCUDAContext *ctx = avctx->priv;
|
OverlayCUDAContext *ctx = avctx->priv;
|
||||||
AVFilterLink *outlink = avctx->outputs[0];
|
AVFilterLink *outlink = avctx->outputs[0];
|
||||||
|
AVFilterLink *inlink = avctx->inputs[0];
|
||||||
|
|
||||||
CudaFunctions *cu = ctx->hwctx->internal->cuda_dl;
|
CudaFunctions *cu = ctx->hwctx->internal->cuda_dl;
|
||||||
CUcontext dummy, cuda_ctx = ctx->hwctx->cuda_ctx;
|
CUcontext dummy, cuda_ctx = ctx->hwctx->cuda_ctx;
|
||||||
|
|
||||||
AVFrame *input_main, *input_overlay;
|
AVFrame *input_main, *input_overlay;
|
||||||
|
const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(inlink->format);
|
||||||
|
|
||||||
|
int hsub = pix_desc->log2_chroma_w;
|
||||||
|
int vsub = pix_desc->log2_chroma_h;
|
||||||
|
|
||||||
ctx->cu_ctx = cuda_ctx;
|
ctx->cu_ctx = cuda_ctx;
|
||||||
|
|
||||||
@ -178,6 +183,9 @@ static int overlay_cuda_blend(FFFrameSync *fs)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ctx->x_position &= (1 << hsub) - 1;
|
||||||
|
ctx->y_position &= (1 << vsub) - 1;
|
||||||
|
|
||||||
// overlay first plane
|
// overlay first plane
|
||||||
|
|
||||||
overlay_cuda_call_kernel(ctx,
|
overlay_cuda_call_kernel(ctx,
|
||||||
|
Loading…
Reference in New Issue
Block a user