History

avfilter/scale_cuda: simplify linesize calculation

Timo Rothenpieler committed 6 years ago

Commit 09e49ba1 parent 94cb78e1 file · +19 −17Browse files

Showing the changes to libavfilter (1 of 1 file). Show all

Unified · Split

libavfilter/vf_scale_cuda.c+19−17
@@ -406,6 +406,8 @@ static int call_resize_kernel(AVFilterContext *ctx, CUfunction func, int channel · 405 unmodified lines
406406 &src_width, &src_height, &bit_depth, &s->param };
407407 int ret;
408408
409+ dst_pitch /= channels;
410+
409411 CUDA_TEXTURE_DESC tex_desc = {
410412 .filterMode = s->interp_use_linear ?
411413 CU_TR_FILTER_MODE_LINEAR :
@@ -421,7 +423,7 @@ static int call_resize_kernel(AVFilterContext *ctx, CUfunction func, int channel · 9 unmodified lines
421423 .res.pitch2D.numChannels = channels,
422424 .res.pitch2D.width = src_width,
423425 .res.pitch2D.height = src_height,
424− .res.pitch2D.pitchInBytes = src_pitch * pixel_size,
426+ .res.pitch2D.pitchInBytes = src_pitch,
425427 .res.pitch2D.devPtr = (CUdeviceptr)src_dptr,
426428 };
427429
@@ -477,16 +479,16 @@ static int scalecuda_resize(AVFilterContext *ctx, · 49 unmodified lines
477479 break;
478480 case AV_PIX_FMT_YUV444P16:
479481 call_resize_kernel(ctx, s->cu_func_ushort, 1,
480− in->data[0], in->width, in->height, in->linesize[0] / 2,
481− out->data[0], out->width, out->height, out->linesize[0] / 2,
482+ in->data[0], in->width, in->height, in->linesize[0],
483+ out->data[0], out->width, out->height, out->linesize[0],
482484 2, 16);
483485 call_resize_kernel(ctx, s->cu_func_ushort, 1,
484− in->data[1], in->width, in->height, in->linesize[1] / 2,
485− out->data[1], out->width, out->height, out->linesize[1] / 2,
486+ in->data[1], in->width, in->height, in->linesize[1],
487+ out->data[1], out->width, out->height, out->linesize[1],
486488 2, 16);
487489 call_resize_kernel(ctx, s->cu_func_ushort, 1,
488− in->data[2], in->width, in->height, in->linesize[2] / 2,
489− out->data[2], out->width, out->height, out->linesize[2] / 2,
490+ in->data[2], in->width, in->height, in->linesize[2],
491+ out->data[2], out->width, out->height, out->linesize[2],
490492 2, 16);
491493 break;
492494 case AV_PIX_FMT_NV12:
@@ -496,34 +498,34 @@ static int scalecuda_resize(AVFilterContext *ctx, · 3 unmodified lines
496498 1, 8);
497499 call_resize_kernel(ctx, s->cu_func_uchar2, 2,
498500 in->data[1], in->width / 2, in->height / 2, in->linesize[1],
499− out->data[1], out->width / 2, out->height / 2, out->linesize[1] / 2,
501+ out->data[1], out->width / 2, out->height / 2, out->linesize[1],
500502 1, 8);
501503 break;
502504 case AV_PIX_FMT_P010LE:
503505 call_resize_kernel(ctx, s->cu_func_ushort, 1,
504− in->data[0], in->width, in->height, in->linesize[0] / 2,
505− out->data[0], out->width, out->height, out->linesize[0] / 2,
506+ in->data[0], in->width, in->height, in->linesize[0],
507+ out->data[0], out->width, out->height, out->linesize[0],
506508 2, 10);
507509 call_resize_kernel(ctx, s->cu_func_ushort2, 2,
508− in->data[1], in->width / 2, in->height / 2, in->linesize[1] / 2,
509− out->data[1], out->width / 2, out->height / 2, out->linesize[1] / 4,
510+ in->data[1], in->width / 2, in->height / 2, in->linesize[1],
511+ out->data[1], out->width / 2, out->height / 2, out->linesize[1],
510512 2, 10);
511513 break;
512514 case AV_PIX_FMT_P016LE:
513515 call_resize_kernel(ctx, s->cu_func_ushort, 1,
514− in->data[0], in->width, in->height, in->linesize[0] / 2,
515− out->data[0], out->width, out->height, out->linesize[0] / 2,
516+ in->data[0], in->width, in->height, in->linesize[0],
517+ out->data[0], out->width, out->height, out->linesize[0],
516518 2, 16);
517519 call_resize_kernel(ctx, s->cu_func_ushort2, 2,
518− in->data[1], in->width / 2, in->height / 2, in->linesize[1] / 2,
519− out->data[1], out->width / 2, out->height / 2, out->linesize[1] / 4,
520+ in->data[1], in->width / 2, in->height / 2, in->linesize[1],
521+ out->data[1], out->width / 2, out->height / 2, out->linesize[1],
520522 2, 16);
521523 break;
522524 case AV_PIX_FMT_0RGB32:
523525 case AV_PIX_FMT_0BGR32:
524526 call_resize_kernel(ctx, s->cu_func_uchar4, 4,
525527 in->data[0], in->width, in->height, in->linesize[0],
526− out->data[0], out->width, out->height, out->linesize[0] / 4,
528+ out->data[0], out->width, out->height, out->linesize[0],
527529 1, 8);
528530 break;
529531 default:

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t