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
406 &src_width, &src_height, &bit_depth, &s->param };406 &src_width, &src_height, &bit_depth, &s->param };
407 int ret;407 int ret;
408 408
409 dst_pitch /= channels;
410
409 CUDA_TEXTURE_DESC tex_desc = {411 CUDA_TEXTURE_DESC tex_desc = {
410 .filterMode = s->interp_use_linear ?412 .filterMode = s->interp_use_linear ?
411 CU_TR_FILTER_MODE_LINEAR :413 CU_TR_FILTER_MODE_LINEAR :
@@ -421,7 +423,7 @@ static int call_resize_kernel(AVFilterContext *ctx, CUfunction func, int channel · 9 unmodified lines
421 .res.pitch2D.numChannels = channels,423 .res.pitch2D.numChannels = channels,
422 .res.pitch2D.width = src_width,424 .res.pitch2D.width = src_width,
423 .res.pitch2D.height = src_height,425 .res.pitch2D.height = src_height,
424 .res.pitch2D.pitchInBytes = src_pitch * pixel_size,426 .res.pitch2D.pitchInBytes = src_pitch,
425 .res.pitch2D.devPtr = (CUdeviceptr)src_dptr,427 .res.pitch2D.devPtr = (CUdeviceptr)src_dptr,
426 };428 };
427 429
@@ -477,16 +479,16 @@ static int scalecuda_resize(AVFilterContext *ctx, · 49 unmodified lines
477 break;479 break;
478 case AV_PIX_FMT_YUV444P16:480 case AV_PIX_FMT_YUV444P16:
479 call_resize_kernel(ctx, s->cu_func_ushort, 1,481 call_resize_kernel(ctx, s->cu_func_ushort, 1,
480 in->data[0], in->width, in->height, in->linesize[0] / 2,482 in->data[0], in->width, in->height, in->linesize[0],
481 out->data[0], out->width, out->height, out->linesize[0] / 2,483 out->data[0], out->width, out->height, out->linesize[0],
482 2, 16);484 2, 16);
483 call_resize_kernel(ctx, s->cu_func_ushort, 1,485 call_resize_kernel(ctx, s->cu_func_ushort, 1,
484 in->data[1], in->width, in->height, in->linesize[1] / 2,486 in->data[1], in->width, in->height, in->linesize[1],
485 out->data[1], out->width, out->height, out->linesize[1] / 2,487 out->data[1], out->width, out->height, out->linesize[1],
486 2, 16);488 2, 16);
487 call_resize_kernel(ctx, s->cu_func_ushort, 1,489 call_resize_kernel(ctx, s->cu_func_ushort, 1,
488 in->data[2], in->width, in->height, in->linesize[2] / 2,490 in->data[2], in->width, in->height, in->linesize[2],
489 out->data[2], out->width, out->height, out->linesize[2] / 2,491 out->data[2], out->width, out->height, out->linesize[2],
490 2, 16);492 2, 16);
491 break;493 break;
492 case AV_PIX_FMT_NV12:494 case AV_PIX_FMT_NV12:
@@ -496,34 +498,34 @@ static int scalecuda_resize(AVFilterContext *ctx, · 3 unmodified lines
496 1, 8);498 1, 8);
497 call_resize_kernel(ctx, s->cu_func_uchar2, 2,499 call_resize_kernel(ctx, s->cu_func_uchar2, 2,
498 in->data[1], in->width / 2, in->height / 2, in->linesize[1],500 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],
500 1, 8);502 1, 8);
501 break;503 break;
502 case AV_PIX_FMT_P010LE:504 case AV_PIX_FMT_P010LE:
503 call_resize_kernel(ctx, s->cu_func_ushort, 1,505 call_resize_kernel(ctx, s->cu_func_ushort, 1,
504 in->data[0], in->width, in->height, in->linesize[0] / 2,506 in->data[0], in->width, in->height, in->linesize[0],
505 out->data[0], out->width, out->height, out->linesize[0] / 2,507 out->data[0], out->width, out->height, out->linesize[0],
506 2, 10);508 2, 10);
507 call_resize_kernel(ctx, s->cu_func_ushort2, 2,509 call_resize_kernel(ctx, s->cu_func_ushort2, 2,
508 in->data[1], in->width / 2, in->height / 2, in->linesize[1] / 2,510 in->data[1], in->width / 2, in->height / 2, in->linesize[1],
509 out->data[1], out->width / 2, out->height / 2, out->linesize[1] / 4,511 out->data[1], out->width / 2, out->height / 2, out->linesize[1],
510 2, 10);512 2, 10);
511 break;513 break;
512 case AV_PIX_FMT_P016LE:514 case AV_PIX_FMT_P016LE:
513 call_resize_kernel(ctx, s->cu_func_ushort, 1,515 call_resize_kernel(ctx, s->cu_func_ushort, 1,
514 in->data[0], in->width, in->height, in->linesize[0] / 2,516 in->data[0], in->width, in->height, in->linesize[0],
515 out->data[0], out->width, out->height, out->linesize[0] / 2,517 out->data[0], out->width, out->height, out->linesize[0],
516 2, 16);518 2, 16);
517 call_resize_kernel(ctx, s->cu_func_ushort2, 2,519 call_resize_kernel(ctx, s->cu_func_ushort2, 2,
518 in->data[1], in->width / 2, in->height / 2, in->linesize[1] / 2,520 in->data[1], in->width / 2, in->height / 2, in->linesize[1],
519 out->data[1], out->width / 2, out->height / 2, out->linesize[1] / 4,521 out->data[1], out->width / 2, out->height / 2, out->linesize[1],
520 2, 16);522 2, 16);
521 break;523 break;
522 case AV_PIX_FMT_0RGB32:524 case AV_PIX_FMT_0RGB32:
523 case AV_PIX_FMT_0BGR32:525 case AV_PIX_FMT_0BGR32:
524 call_resize_kernel(ctx, s->cu_func_uchar4, 4,526 call_resize_kernel(ctx, s->cu_func_uchar4, 4,
525 in->data[0], in->width, in->height, in->linesize[0],527 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],
527 1, 8);529 1, 8);
528 break;530 break;
529 default:531 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