From patchwork Fri Jan 24 14:14:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul B Mahol X-Patchwork-Id: 17576 Delivered-To: andriy.gelman@gmail.com Received: by 2002:a05:6214:1865:0:0:0:0 with SMTP id eh5csp383253qvb; Fri, 24 Jan 2020 06:14:52 -0800 (PST) X-Google-Smtp-Source: APXvYqzoBRZ09fM7LGwjEM8aqqJrzCcxoJGqWiG36VMFtmyKelPpHtTeAL8AxzBkFeDkyDhaxIBG X-Received: by 2002:a05:6402:1d0d:: with SMTP id dg13mr2851890edb.104.1579875292001; Fri, 24 Jan 2020 06:14:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579875291; cv=none; d=google.com; s=arc-20160816; b=Q40E3O3XZYmqHD12WSWKJynopr66VdZ3xifMmatd39KKiHq6GJ703/N0iC9Slj2AS3 ccjpzRhcwU/nBuFTIc3oxcmsMkAeYqsenF3aVLE4587m06Y/w70XdTnNDgjq9dq8a4Yo t+oCwRElckelhVfT8vbyuVIyVlU6FJMhls/Ous919D/ujpXW5ViXYSAXruVpYBGt4N+H hq++gdbqg82r5taM199g0lnddT3K02YRwT+Jkem7x+mLnbhsqsXup3vwbp7/n6EHIyde HOXFSkxjYbL+dwA4O3RzcPgA2v+me7gDkdUyEP4ZRDbvCKjHrgP4yWrgNShJjFAL0r2C 8eug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to; bh=IQQY/hJ37wRkx1bRZBcK6O2pc+NuoCWlY/XhKeWo0ic=; b=pZBXrFjQrht9vnnP+eIQBX3lBuOsuxCBIXjf4XjtOssmtbU7+v6OoMhWEyLjE2zxyu 84d+zByk8gRBKIPwMtAlXgIy+tgw8A9V9I36nzYvGLbRxX4T64tEeAsvKaIjIhN2Ro8I PS2OflmRFPQ+/mfDPokBKLTXLBPIa/MQyohgcowSTEINz/mUum+8np82Q+DNT7Zat4rT KnvQ6dkpr3Y68fFEvcVjeXvWsgw5puw/TK/GOp5yTVp6mnIeJ1itc+ohq3pjnfM1LXUD kF1lyVr/AxXGhgNl/x1KnednaN2xidfLK2ayBNlgAPy0e5olYGT2g5H83KRufiBGKl2u eIrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=PZIrCTEC; 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 n9si30278220ejc.119.2020.01.24.06.14.51; Fri, 24 Jan 2020 06:14:51 -0800 (PST) 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=PZIrCTEC; 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 6967968B0F1; Fri, 24 Jan 2020 16:14:47 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6A289687F8F for ; Fri, 24 Jan 2020 16:14:40 +0200 (EET) Received: by mail-wm1-f66.google.com with SMTP id t14so1841720wmi.5 for ; Fri, 24 Jan 2020 06:14:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=J+SSfNO3FvrfXpbiIKiyLtF5n5nx9umvq3T9v7lW6yI=; b=PZIrCTEC0GNlCp/CxfWwJo1mYdODxgHR0/F9LtMYJJAFcFK+kv405ZAU8hYTscPxxs Pi1ElBZgYnFQabDpqp2lZAJJnqW/9W8Twi9Tf8Z/DMdImp0Sd7e12Z6CQshmrvqmLTVI HJp6IbAR134YaCZHgki8rzTS2hmgcHEhpZKIbp57/hn5gSktQxbtBBeRgGDT+EtD/52d +wuhhPytH0eGcpa0+ZXcPX5Qy9DJ19GN+ndvYxLBIXnyoWqaRW6RVl5TBM8ucVMg62U3 RtqhIip/wt8jQtniLo8oaRvd2gVinRAAnRCD14YqNNxvlYqZ4IH0MgM+To2dXcsk/pWW VsXQ== 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:in-reply-to :references; bh=J+SSfNO3FvrfXpbiIKiyLtF5n5nx9umvq3T9v7lW6yI=; b=aLGNKpBKlqpQoHoy+YzJdl5Qdw9Ibq/I73kp4mwYlbehVn8HH4x7VKQGaSSrensxdr FtF67XYfg7FRtM9BugSusXFPggltkrDWnLJjdIMLGenss1C5M7tH8Vup8YSqe/yI23sq MLBYE1yBSU8my02oXL3S2PcIRUH16OSrA1lye0zURq84OLkxHgSr0jg7jRl94dhXTV2g XR73HSdE7URRAVIYxREZZdotzjm5uj2x8DhgHTWF0+PjwGKAWhLIy9Pc4OUvninlxwiN UZS6c7mXeEQwaLcs/RrbYRsiyfNOmFu+ghQ33+AQ6Y7N4lhSmNkpgD/oD4+XOBLSc53g zHVw== X-Gm-Message-State: APjAAAWAEXZdcvoAjcLrl9/i5M2ZULN4iLw9FPwMurrY0J99lk/Rb8Zg x8t8UakLEvJbuw+rKuk7p/QTJHDvhDo= X-Received: by 2002:a1c:e3c2:: with SMTP id a185mr3507310wmh.27.1579875278939; Fri, 24 Jan 2020 06:14:38 -0800 (PST) Received: from localhost.localdomain ([94.250.182.166]) by smtp.gmail.com with ESMTPSA id 5sm7749463wrh.5.2020.01.24.06.14.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2020 06:14:37 -0800 (PST) From: Paul B Mahol To: ffmpeg-devel@ffmpeg.org Date: Fri, 24 Jan 2020 15:14:30 +0100 Message-Id: <20200124141430.8675-1-onemda@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200124123952.15984-2-onemda@gmail.com> References: <20200124123952.15984-2-onemda@gmail.com> Subject: [FFmpeg-devel] [PATCH 2/2] avcodec/dnxhdenc: properly store colorspace info 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 68xbnsQGPfwG Content-Length: 2789 Signed-off-by: Paul B Mahol --- libavcodec/dnxhdenc.c | 11 ++++++++++- libavcodec/dnxhdenc.h | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c index 2feb8baf21..03835fa794 100644 --- a/libavcodec/dnxhdenc.c +++ b/libavcodec/dnxhdenc.c @@ -406,6 +406,15 @@ static av_cold int dnxhd_encode_init(AVCodecContext *avctx) } ctx->is_444 = ctx->profile == FF_PROFILE_DNXHR_444; + + switch (avctx->colorspace) { + case AVCOL_SPC_UNSPECIFIED: + case AVCOL_SPC_BT709: ctx->colorspace = 0; break; + case AVCOL_SPC_BT2020_NCL: ctx->colorspace = 1; break; + case AVCOL_SPC_BT2020_CL: ctx->colorspace = 2; break; + default: ctx->colorspace = 3; break; + } + avctx->profile = ctx->profile; ctx->cid = ff_dnxhd_find_cid(avctx, ctx->bit_depth); if (!ctx->cid) { @@ -576,7 +585,7 @@ static int dnxhd_write_header(AVCodecContext *avctx, uint8_t *buf) buf[0x21] = ctx->bit_depth == 10 ? 0x58 : 0x38; buf[0x22] = 0x88 + (ctx->interlaced << 2); AV_WB32(buf + 0x28, ctx->cid); // CID - buf[0x2c] = (!ctx->interlaced << 7) | (ctx->is_444 << 6) | (avctx->pix_fmt == AV_PIX_FMT_YUV444P10); + buf[0x2c] = (!ctx->interlaced << 7) | (ctx->is_444 << 6) | (ctx->colorspace << 1) | (avctx->pix_fmt == AV_PIX_FMT_YUV444P10); buf[0x5f] = 0x01; // UDL diff --git a/libavcodec/dnxhdenc.h b/libavcodec/dnxhdenc.h index 7b0d862e28..4d5f457e33 100644 --- a/libavcodec/dnxhdenc.h +++ b/libavcodec/dnxhdenc.h @@ -50,6 +50,7 @@ typedef struct DNXHDEncContext { int profile; int bit_depth; int is_444; + int colorspace; const CIDEntry *cid_table; uint8_t *msip; ///< Macroblock Scan Indexes Payload uint32_t *slice_size;