Yes, this looks better and should have been this way.

Thanks,
Yogender

-----Original Message-----
From: Philip Langdale <phil...@overt.org> 
Sent: Tuesday, May 14, 2019 8:42 AM
To: ffmpeg-devel@ffmpeg.org
Cc: Yogender Gupta <ygu...@nvidia.com>; Philip Langdale <phil...@overt.org>
Subject: [PATCH 3/3] avfilter/vf_scale_cuda: Simplify output plane addressing

I'm not sure why this was written the way it was originally. We initialise the 
plane addresses correctly in hwcontext_cuda so why try and play games to 
calculate the plane offsets directly in this code?
---
 libavfilter/vf_scale_cuda.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/libavfilter/vf_scale_cuda.c b/libavfilter/vf_scale_cuda.c index 
a833dcd1a4..b7cdb81081 100644
--- a/libavfilter/vf_scale_cuda.c
+++ b/libavfilter/vf_scale_cuda.c
@@ -390,12 +390,12 @@ static int scalecuda_resize(AVFilterContext *ctx,
                            out->data[0], out->width, out->height, 
out->linesize[0],
                            1);
         call_resize_kernel(ctx, s->cu_func_uchar, 1,
-                           in->data[0]+in->linesize[0]*in->height, 
in->width/2, in->height/2, in->linesize[0]/2,
-                           out->data[0]+out->linesize[0]*out->height, 
out->width/2, out->height/2, out->linesize[0]/2,
+                           in->data[1], in->width/2, in->height/2, 
in->linesize[0]/2,
+                           out->data[1], out->width/2, out->height/2, 
+ out->linesize[0]/2,
                            1);
         call_resize_kernel(ctx, s->cu_func_uchar, 1,
-                           in->data[0]+ 
ALIGN_UP((in->linesize[0]*in->height*5)/4, s->tex_alignment), in->width/2, 
in->height/2, in->linesize[0]/2,
-                           out->data[0]+(out->linesize[0]*out->height*5)/4, 
out->width/2, out->height/2, out->linesize[0]/2,
+                           in->data[2], in->width/2, in->height/2, 
in->linesize[0]/2,
+                           out->data[2], out->width/2, out->height/2, 
+ out->linesize[0]/2,
                            1);
         break;
     case AV_PIX_FMT_YUV444P:
@@ -404,12 +404,12 @@ static int scalecuda_resize(AVFilterContext *ctx,
                            out->data[0], out->width, out->height, 
out->linesize[0],
                            1);
         call_resize_kernel(ctx, s->cu_func_uchar, 1,
-                           in->data[0]+in->linesize[0]*in->height, in->width, 
in->height, in->linesize[0],
-                           out->data[0]+out->linesize[0]*out->height, 
out->width, out->height, out->linesize[0],
+                           in->data[1], in->width, in->height, in->linesize[0],
+                           out->data[1], out->width, out->height, 
+ out->linesize[0],
                            1);
         call_resize_kernel(ctx, s->cu_func_uchar, 1,
-                           in->data[0]+in->linesize[0]*in->height*2, 
in->width, in->height, in->linesize[0],
-                           out->data[0]+out->linesize[0]*out->height*2, 
out->width, out->height, out->linesize[0],
+                           in->data[2], in->width, in->height, in->linesize[0],
+                           out->data[2], out->width, out->height, 
+ out->linesize[0],
                            1);
         break;
     case AV_PIX_FMT_YUV444P16:
@@ -433,7 +433,7 @@ static int scalecuda_resize(AVFilterContext *ctx,
                            1);
         call_resize_kernel(ctx, s->cu_func_uchar2, 2,
                            in->data[1], in->width/2, in->height/2, 
in->linesize[1],
-                           out->data[0] + out->linesize[0] * ((out->height + 
31) & ~0x1f), out->width/2, out->height/2, out->linesize[1]/2,
+                           out->data[1], out->width/2, out->height/2, 
+ out->linesize[1]/2,
                            1);
         break;
     case AV_PIX_FMT_P010LE:
@@ -443,7 +443,7 @@ static int scalecuda_resize(AVFilterContext *ctx,
                            2);
         call_resize_kernel(ctx, s->cu_func_ushort2, 2,
                            in->data[1], in->width / 2, in->height / 2, 
in->linesize[1]/2,
-                           out->data[0] + out->linesize[0] * ((out->height + 
31) & ~0x1f), out->width / 2, out->height / 2, out->linesize[1] / 4,
+                           out->data[1], out->width / 2, out->height / 
+ 2, out->linesize[1] / 4,
                            2);
         break;
     case AV_PIX_FMT_P016LE:
@@ -453,7 +453,7 @@ static int scalecuda_resize(AVFilterContext *ctx,
                            2);
         call_resize_kernel(ctx, s->cu_func_ushort2, 2,
                            in->data[1], in->width / 2, in->height / 2, 
in->linesize[1] / 2,
-                           out->data[0] + out->linesize[0] * ((out->height + 
31) & ~0x1f), out->width / 2, out->height / 2, out->linesize[1] / 4,
+                           out->data[1], out->width / 2, out->height / 
+ 2, out->linesize[1] / 4,
                            2);
         break;
     default:
--
2.20.1

-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may 
contain
confidential information.  Any unauthorized review, use, disclosure or 
distribution
is prohibited.  If you are not the intended recipient, please contact the 
sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to