From patchwork Mon May 13 11:18:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Svechnikov X-Patchwork-Id: 13092 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 6088944761E for ; Mon, 13 May 2019 14:24:08 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 481426882B9; Mon, 13 May 2019 14:24:08 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lf1-f68.google.com (mail-lf1-f68.google.com [209.85.167.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4451D680CB6 for ; Mon, 13 May 2019 14:24:02 +0300 (EEST) Received: by mail-lf1-f68.google.com with SMTP id d8so8732291lfb.8 for ; Mon, 13 May 2019 04:24:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=EC845NZxED7rnWqvawZ1FxpoF3pg7J1YwSmTWUJecVU=; b=SJtJK/QZTuBRVOomSIKvrPqidBGjLiQlBV1GDdiS2woEmYYjKtlI93Gd3/Q0MBKYcm lBN2dsJZ6uURxdhmUkCcVQriGP11y1U5+v04Dx1CDtG1u0uPjQTjmi0ioDpLzfjlqqpy VVugELRjHcinQLvgykBLjRFYmBEE9H2xFXa5E7amuz4DfvPSTp476+fCkwtgPxraR2HL Oxk/AaQ5KU1lteEtg+NN8ci/QiYdztxfY5krEzGs+FA4ncNnL6qMXR+JEkXdiHdjdNcI UwF9Q6++a6DNRGnYArsP90qyd9jLMvCbpw/VBvccE/Mqkb75Z1DPDfk4fTwd5YkTGcFD 5TCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=EC845NZxED7rnWqvawZ1FxpoF3pg7J1YwSmTWUJecVU=; b=dN1YCvp6mRu0GZ0X14KsjAM1F/ZMXYAff/EWzFJwG3EJF5QE/yIFE68sknNgJSZ3Nr WZh89eaxnHWQXF2jOhzqLJpW8uCmK248oLlaA4KiC+dVBf91FsUWLQKt7uoBOLpE03jM coCBCLswMcFFMQ8qTk1DKE9HDWV9cv8cM9sezcyOe+pUBQyVu1+R1lhfPXn2GtsCdkkM DUOvWJADgH14hWYLgNKYkT4ZiLYv0DQrBbVyVyrrD1UUJOWcINyOuFOGJBn8Mcd+SAir W42fJoK/sZtLkZYbzW0OIsEECx22KBZlqaFTeRwRXAyNY0xvpR3nJc9MBkVTb5MPzQGX CLpQ== X-Gm-Message-State: APjAAAU99lV5LU49EgFC3Grb72CKdCqLIhw7+agkyT8L+dLlGoTDy+Eo lYwgam6gnbWo5tsTkmP88qwv7z5c54U= X-Google-Smtp-Source: APXvYqybGF0wFaZgg+S8AIBDzukYz56aOukf15Ce431BgYx3XDlooJ2Zn149MHasYKm3XFomqKxB0Q== X-Received: by 2002:a19:c60f:: with SMTP id w15mr13334585lff.61.1557746292520; Mon, 13 May 2019 04:18:12 -0700 (PDT) Received: from tcodertest.corp.itmh.ru ([2a02:17d0:8102:1300:1e87:2cff:fe60:bccf]) by smtp.googlemail.com with ESMTPSA id o7sm3069061lfl.13.2019.05.13.04.18.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 13 May 2019 04:18:11 -0700 (PDT) From: Sergey Svechnikov To: ffmpeg-devel@ffmpeg.org Date: Mon, 13 May 2019 11:18:09 +0000 Message-Id: <1557746289-636-1-git-send-email-svechnikov66@gmail.com> X-Mailer: git-send-email 2.7.4 Subject: [FFmpeg-devel] [PATCH] libavfilter/vf_scale_cuda: fix src_pitch for 10bit videos X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Sergey Svechnikov MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" When scaling a 10bit video using scale_cuda filter (witch uses pixel format AV_PIX_FMT_P010LE), the output video gets distorted. I think it has something to do with the differences in processing between cuda_sdk and ffnvcodec with cuda_nvcc (the problem appears after this commit https://github.com/FFmpeg/FFmpeg/commit/2544c7ea67ca9521c5de36396bc9ac7058223742). To solve the problem we should not divide the input frame planes' linesizes by 2 and leave them as they are. More info, samples and reproduction steps are here https://github.com/Svechnikov/ffmpeg-scale-cuda-10bit-problem --- libavfilter/vf_scale_cuda.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavfilter/vf_scale_cuda.c b/libavfilter/vf_scale_cuda.c index c97a802..7fc33ee 100644 --- a/libavfilter/vf_scale_cuda.c +++ b/libavfilter/vf_scale_cuda.c @@ -423,11 +423,11 @@ static int scalecuda_resize(AVFilterContext *ctx, break; case AV_PIX_FMT_P010LE: call_resize_kernel(ctx, s->cu_func_ushort, 1, - in->data[0], in->width, in->height, in->linesize[0]/2, + in->data[0], in->width, in->height, in->linesize[0], out->data[0], out->width, out->height, out->linesize[0]/2, 2); call_resize_kernel(ctx, s->cu_func_ushort2, 2, - in->data[1], in->width / 2, in->height / 2, in->linesize[1]/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] / 4, 2); break;