From patchwork Sat Jun 16 15:49:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carl Eugen Hoyos X-Patchwork-Id: 9424 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:11c:0:0:0:0:0 with SMTP id c28-v6csp2014278jad; Sat, 16 Jun 2018 08:50:05 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIKbQ4JRLtWRhoeE6p9dqq5k5iZtiCEzR8xcoSw5FJjw1DHJnhcviWQT+Fiw79SemqMh2z6 X-Received: by 2002:a1c:b801:: with SMTP id i1-v6mr3983618wmf.30.1529164205534; Sat, 16 Jun 2018 08:50:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529164205; cv=none; d=google.com; s=arc-20160816; b=CCO7IBdNKn8fiAo6QwGZpmkR6fPpBgiLolKgWiJaepprMKoQY5jOHDU16CEkkojcvE Z/sDqaCBKtMAYv26LesBiClcX00QctdNhgsdRL28O7GBTZlLNaI8tZrKnENfGZ0f5NWE nDJBQX7qWnpltySyXItFpJK3D3ErZcTRtoepak6XyMtzsAIgm00/+J7YyO1fIEQ9aW+K mwa2Q6x8KA+czMTDwfAIyVMzUjPlJB0s8k+3czUq2HYA8/5mO2YN/GBAShsr7eNB6NJ8 hOK9GkwY/IUJGQzZGKFpXNDOzSn6eZ/+fA0NYAdYpt4zb49AoqtcpmO1m8ehHQW2cWeq DD6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject:to :message-id:date:from:mime-version:dkim-signature:delivered-to :arc-authentication-results; bh=u5US6er3WHPvb6UkB0BLrTOIWfyKv0QTs5DhORgC+18=; b=1Bi/bhPYMTE3XkEcNVzoShQ5nRu/k6lv/h070QrcgKfhEFm9Jdi1i/oqknNdKbs/u7 wQKRq1400gSJ9xhVNo+pqITSfzpuu2p+BTIJ4gVjfOBKs5+3/2LZbsRhKYzINxKr3ZDy qMWvUEw50YEb4oBPcK+nnxh9IDr4f+ByLBZ0VIdoyeU+dbXHx0ysC4NSgz34ulnDvra+ VBAKSIO7ge5dBNB+WLE0GGJe3bx5ThAVO5dwxtpn898icb+ThP8zFB0kfmw80Q7VGn5v fN3eV4e1KWLD7DdL8iRfKlJE6/WW0hYD+NH386nm4zASmvNcgwZXTbXjaxyNfSvwguOi DX9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=ayFy+y2d; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id r13-v6si9084893wro.401.2018.06.16.08.50.04; Sat, 16 Jun 2018 08:50:05 -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=@gmail.com header.s=20161025 header.b=ayFy+y2d; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 24B6E68A0D3; Sat, 16 Jun 2018 18:49:11 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-io0-f169.google.com (mail-io0-f169.google.com [209.85.223.169]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 107B4689DFA for ; Sat, 16 Jun 2018 18:49:05 +0300 (EEST) Received: by mail-io0-f169.google.com with SMTP id t6-v6so13267160iob.10 for ; Sat, 16 Jun 2018 08:49:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=nRX+7lLce6p2pEfZCtR0SgzoHSP/KLFF6DNryNVbkkU=; b=ayFy+y2dI18aq0pH51M8O2Wkwk50rZd0E0AC+BFW5HgzyqWWftmSegom7XiFcICu5y k4swGeNGnnYINEhQ9Hep0MxnrtH0yfd4kbG2WawMYoPizrIOzDGTLVd3ABMNeOJ1Ulez Wi/G2eoKMzxiTw8XV8eLILf6QRG+L2gMMny72bxBCt2uw3M8jBG2Fj7X1Lww3IRXgp2j +tt6p2VZV4LNB1F81NwF6iR6qRYkYvDq+ORfPuGFZ48uhjAS0ZKX0EWdfWkcShlWSa5O esehT/ggS5S/ynDl/O+P69W8Y1/K6UGHyXBVk8Jgb+r1U6oDvxddetx2egRSO5KlGuv+ t3rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=nRX+7lLce6p2pEfZCtR0SgzoHSP/KLFF6DNryNVbkkU=; b=rgg7VcKqZwWn0WFdq0IPapf5I8VLy+nZgHPjRRwAqLrd90bkHMRQqD3hG3OwctMx/5 c0yvNQTdV4LPGaysB2pu5h7Untd4yD4PvJs8mbke/tw7Qij1tNNjoCSVG94AJHtr5RUD HPpT8oPA7dNdfyFLvzP2mTcmSGkaflZpUUfVruJsIdxz+yEZBFzrHo8IEjV0BHnLKV6k yplVidAVnMT1Tp93qEbX/IGzBvWFTjMteO3sUf5+XNCLNJJI5vudUZR0fZ2oWzYBatG/ 5Ch/YolXinaddOOzvBpAEKQoX2T+dNAC55Rk9es6QdCYpinc0w68DguSFsqxu2BqYd6f Xvdw== X-Gm-Message-State: APt69E2CvU87J7DNpVaIGgBjyZr6nGh6uRB7tRg2+y/2pUMtOATFo7GJ GJvIZj+HsPaY7+hx+dOv342mDFyR7L51ovp+0ZE= X-Received: by 2002:a6b:9f86:: with SMTP id i128-v6mr5067639ioe.286.1529164195118; Sat, 16 Jun 2018 08:49:55 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a02:b09b:0:0:0:0:0 with HTTP; Sat, 16 Jun 2018 08:49:54 -0700 (PDT) From: Carl Eugen Hoyos Date: Sat, 16 Jun 2018 17:49:54 +0200 Message-ID: To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] [PATCH]lavc/dpx: Support 10-bit packing method b (msbpad) 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" Hi! Attached patch allows to decode 10-bit dpx files with packing method b, needs the 12-bit patch. Please comment, Carl Eugen From 401bdebba6dc8fa2253c720107a971b3fbf2c312 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Sat, 16 Jun 2018 17:47:46 +0200 Subject: [PATCH] lavc/dpx: Support 10-bit packing method b (msbpad). --- libavcodec/dpx.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/libavcodec/dpx.c b/libavcodec/dpx.c index 69d594b..0650a20 100644 --- a/libavcodec/dpx.c +++ b/libavcodec/dpx.c @@ -51,7 +51,7 @@ static unsigned int read32(const uint8_t **ptr, int is_big) } static uint16_t read10in32(const uint8_t **ptr, uint32_t * lbuf, - int * n_datum, int is_big) + int * n_datum, int is_big, int shift) { if (*n_datum) (*n_datum)--; @@ -60,7 +60,7 @@ static uint16_t read10in32(const uint8_t **ptr, uint32_t * lbuf, *n_datum = 2; } - *lbuf = (*lbuf << 10) | (*lbuf >> 22); + *lbuf = (*lbuf << 10) | (*lbuf >> shift); return *lbuf & 0x3FF; } @@ -221,7 +221,7 @@ static int decode_frame(AVCodecContext *avctx, stride = avctx->width * elements; break; case 10: - if (!packing || packing > 1) { + if (!packing) { av_log(avctx, AV_LOG_ERROR, "Packing to 32bit required\n"); return -1; } @@ -360,17 +360,18 @@ static int decode_frame(AVCodecContext *avctx, (uint16_t*)ptr[1], (uint16_t*)ptr[2], (uint16_t*)ptr[3]}; + int shift = packing == 1 ? 22 : 20; for (y = 0; y < avctx->width; y++) { *dst[2]++ = read10in32(&buf, &rgbBuffer, - &n_datum, endian); + &n_datum, endian, shift); *dst[0]++ = read10in32(&buf, &rgbBuffer, - &n_datum, endian); + &n_datum, endian, shift); *dst[1]++ = read10in32(&buf, &rgbBuffer, - &n_datum, endian); + &n_datum, endian, shift); if (elements == 4) *dst[3]++ = read10in32(&buf, &rgbBuffer, - &n_datum, endian); + &n_datum, endian, shift); } n_datum = 0; for (i = 0; i < elements; i++) -- 1.7.10.4