From patchwork Thu Sep 1 17:49:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Timo Rothenpieler X-Patchwork-Id: 387 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.140.134 with SMTP id o128csp1035348vsd; Thu, 1 Sep 2016 10:50:01 -0700 (PDT) X-Received: by 10.28.70.5 with SMTP id t5mr28477397wma.46.1472752195379; Thu, 01 Sep 2016 10:49:55 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 204si7771669wmk.102.2016.09.01.10.49.52; Thu, 01 Sep 2016 10:49:55 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@rothenpieler.org; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A3CC7689B36; Thu, 1 Sep 2016 20:49:43 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from btbn.de (btbn.de [5.9.118.179]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8038068998B for ; Thu, 1 Sep 2016 20:49:37 +0300 (EEST) Received: from localhost.localdomain (ip4d1666ad.dynamic.kabel-deutschland.de [77.22.102.173]) by btbn.de (Postfix) with ESMTPSA id 8D7F84BA37; Thu, 1 Sep 2016 19:49:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rothenpieler.org; s=mail; t=1472752184; bh=VL5wGz8158pmdR3ksfN+XU/ASIWwK4cq5yv2oF4BHKQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=GkX4p4WJeZEqYQa1GOBgbMQiyVki4QqQUWPYNj66ESggckYj5ReRL0xPj+VXEIasm YD3JS0oRv+Ve37abctJMyr/EoVqpK9LC9ecknoznAVwsWo6s14DcAFaCxIyD6TMwBy 6lo3BKd/DPHTBzPK5nlcmKZgU8BQtmsxrXkE1Fd0= From: Timo Rothenpieler To: ffmpeg-devel@ffmpeg.org Date: Thu, 1 Sep 2016 19:49:38 +0200 Message-Id: <20160901174938.7366-1-timo@rothenpieler.org> X-Mailer: git-send-email 2.9.2 In-Reply-To: <20160901152304.5689-1-timo@rothenpieler.org> References: <20160901152304.5689-1-timo@rothenpieler.org> Subject: [FFmpeg-devel] [PATCH] swscale: add unscaled copy from yuv420p10 to p010 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: Timo Rothenpieler MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- libswscale/swscale_unscaled.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c index b231abe..f47e1f4 100644 --- a/libswscale/swscale_unscaled.c +++ b/libswscale/swscale_unscaled.c @@ -197,6 +197,43 @@ static int nv12ToPlanarWrapper(SwsContext *c, const uint8_t *src[], return srcSliceH; } +static int planarToP010Wrapper(SwsContext *c, const uint8_t *src8[], + int srcStride[], int srcSliceY, + int srcSliceH, uint8_t *dstParam8[], + int dstStride[]) +{ + uint16_t *src[] = { + (uint16_t*)(src8[0] + srcStride[0] * srcSliceY), + (uint16_t*)(src8[1] + srcStride[1] * srcSliceY), + (uint16_t*)(src8[2] + srcStride[2] * srcSliceY) + }; + uint16_t *dstY = (uint16_t*)(dstParam8[0] + dstStride[0] * srcSliceY); + uint16_t *dstUV = (uint16_t*)(dstParam8[1] + dstStride[1] * srcSliceY / 2); + int x, y; + + av_assert0(!(srcStride[0] % 2 || srcStride[1] % 2 || srcStride[2] % 2 || + dstStride[0] % 2 || dstStride[1] % 2)); + + for (y = srcSliceY; y < srcSliceY + srcSliceH; y++) { + if (!(y & 1)) { + for (x = 0; x < c->srcW / 2; x++) { + dstUV[x*2 ] = src[1][x] << 6; + dstUV[x*2+1] = src[2][x] << 6; + } + src[1] += srcStride[1] / 2; + src[2] += srcStride[2] / 2; + dstUV += dstStride[1] / 2; + } + for (x = 0; x < c->srcW; x++) { + dstY[x] = src[0][x] << 6; + } + src[0] += srcStride[0] / 2; + dstY += dstStride[0] / 2; + } + + return srcSliceH; +} + static int planarToYuy2Wrapper(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dstParam[], int dstStride[]) @@ -1600,6 +1637,11 @@ void ff_get_unscaled_swscale(SwsContext *c) !(flags & SWS_ACCURATE_RND) && (c->dither == SWS_DITHER_BAYER || c->dither == SWS_DITHER_AUTO) && !(dstH & 1)) { c->swscale = ff_yuv2rgb_get_func_ptr(c); } + /* yuv420p10le_to_p010le */ + if ((srcFormat == AV_PIX_FMT_YUV420P10 || srcFormat == AV_PIX_FMT_YUVA420P10) && + dstFormat == AV_PIX_FMT_P010) { + c->swscale = planarToP010Wrapper; + } if (srcFormat == AV_PIX_FMT_YUV410P && !(dstH & 3) && (dstFormat == AV_PIX_FMT_YUV420P || dstFormat == AV_PIX_FMT_YUVA420P) &&