From patchwork Thu Sep 12 03:59:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rodger Combs X-Patchwork-Id: 15036 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 A6597448193 for ; Thu, 12 Sep 2019 07:07:49 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 73788680C0F; Thu, 12 Sep 2019 07:07:49 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-io1-f68.google.com (mail-io1-f68.google.com [209.85.166.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 35FFF6805FB for ; Thu, 12 Sep 2019 07:07:42 +0300 (EEST) Received: by mail-io1-f68.google.com with SMTP id f12so51215202iog.12 for ; Wed, 11 Sep 2019 21:07:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=9ja7xxdLf5fWywz28XCaaqYLRr9hnxmcLWnz951U7ow=; b=Y0k1XzFT6P2nE0irn9DNNuxCmveER9XPQtZEZCM11jX6P4Qla86UGq/+qRdsdUPFuM GMu/sz/1rQGOh21scKJOa08knuftgyqWlj7R4l2fWXV7fCioahEvrVjyfcjKlBLxDDHo TubK2ITD6mbRjB4Jtm/Thb0FpKwcRKXNwXkPE43UXfinnDIttrI9Kz4GVsU903eExobI 7Vx7hYmJ+dO205nk7R8XKD9P9Bg6sfnKCtLV8/S6MT9O6BdmeLU7Jw1/a4kQAZFZN8SJ Yprp/p+VgK0JJa8KhEhoTRUNrjuraTU4Yp2UumG5UWFMyqw9wC8kBuKE/CuEP5aHoPpN qVFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=9ja7xxdLf5fWywz28XCaaqYLRr9hnxmcLWnz951U7ow=; b=Gs22xoIo6v2jMdc99Iavt2n7kDKjjVAtvAy727eAcCI+Uo07w4Ev/Aik3iqgvEMY4r nsvPgOwcI/FkP9tsbHtPjNmuZ/X2LesvYJrjjJX4C6EPf6l6pOvg4PJbAEpvAwNxosiy fGK9ExfpxmbNOCmvShaxMc6RaNBB0tD2/x6hlKnoBs1L6362wW3GK0PTdon18LtvPhvo Czzw2CaVJdUVX20aIB6qFVJqJfnThO9m+X2keNSdwRlr9xwJn7inUegG9GPSMDZCKkTk sPCF4GIOgmJ1Hz4GNRulJ2iFmRpecv4av043GkMNa/S5wfh+zhelIxjevb5orRZhfjy1 fxLQ== X-Gm-Message-State: APjAAAVWLDO7RyOm3ATmYW4u1hIqteWrqU77TydS1gL/+8kertnyydF3 +ytntQ7vgXDao84TXHjpEmLhae+uuls= X-Google-Smtp-Source: APXvYqxfS0TKIYcBT66B7pQe45ioU3P5V8AcN8YSM8CMQJgsz6NGWk7IBNLdDmseice2z/z4MjYXPw== X-Received: by 2002:a05:6638:a:: with SMTP id z10mr11690532jao.113.1568260771361; Wed, 11 Sep 2019 20:59:31 -0700 (PDT) Received: from MacBook-Pro.localdomain ([24.14.135.13]) by smtp.gmail.com with ESMTPSA id i20sm7692614ioh.77.2019.09.11.20.59.29 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Sep 2019 20:59:30 -0700 (PDT) From: Rodger Combs To: ffmpeg-devel@ffmpeg.org Date: Wed, 11 Sep 2019 22:59:23 -0500 Message-Id: <20190912035923.69349-1-rodger.combs@gmail.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] lavu/hwcontext_qsv: update crop width/height when mapping frames 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" This fixes an issue where the context could be configured with one resolution, but incoming frames could have another, and our output AVFrames wouldn't match the underlying surfaces' resolution, which is usually the value that MFX code uses. In particular, this would happen when mapping from DXVA2 decoders, since DXVA2 aligns the width/height fields in its context to the required alignment for the particular codec being used, and those values are then propagated into the QSV context, rather than the crop dimensions. --- libavutil/hwcontext_qsv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c index 8f9838d7d8..fe5a705c19 100644 --- a/libavutil/hwcontext_qsv.c +++ b/libavutil/hwcontext_qsv.c @@ -1031,8 +1031,8 @@ static int qsv_map_to(AVHWFramesContext *dst_ctx, if (err) return err; - dst->width = src->width; - dst->height = src->height; + hwctx->surfaces[i].Info.CropW = dst->width = src->width; + hwctx->surfaces[i].Info.CropH = dst->height = src->height; dst->data[3] = (uint8_t*)&hwctx->surfaces[i]; return 0;