From patchwork Tue Jul 30 20:19:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 14152 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 C304F447006 for ; Tue, 30 Jul 2019 23:22:06 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A7A56689992; Tue, 30 Jul 2019 23:22:06 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qk1-f196.google.com (mail-qk1-f196.google.com [209.85.222.196]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 83679689A5E for ; Tue, 30 Jul 2019 23:21:58 +0300 (EEST) Received: by mail-qk1-f196.google.com with SMTP id m14so21848624qka.10 for ; Tue, 30 Jul 2019 13:21:58 -0700 (PDT) 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:mime-version :content-transfer-encoding; bh=pxgtxBt4sIQ/3EcdZVFku8AD74zbo7fi1uheginX8A4=; b=gzTJ/Q/5ribGmF+1IKMkAefP79w87w5H84ox61w3ZNY2PP0MYH78bKfDjcfovgFzZ7 pDhlkaMAeFQL0vGuIWx2wVGIzNHaikX/WCQGmuc1nC2DE3HsXnSZQM/JETxEmXYa2/tY nn6Jg73hAn+mfq3vFxpt4nMVm5SdJmTIXouBE+EFrfgwqWJ4uOkzlpe5yiG/OET/600T kfjKZ/HByg4iWIF+RtjsKiYY++KA5MWeX2t6jzNXYJ40z4ZEWIlmJneFv7/Xow0G0vdS +QOVp6EXklK2FKntHJOEgMsBU8jebp7DszwlDtzzCHe7KNRYXPrEkMj+icebr8TfLPI3 1f+g== 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:mime-version:content-transfer-encoding; bh=pxgtxBt4sIQ/3EcdZVFku8AD74zbo7fi1uheginX8A4=; b=pNMjIZHPmywBfv5C1F3ZJ/UqYHks/g+MQJ3cpaHPs1F0Yw+t18RRkEbUdNzUtMOQ7f V2Q192hdGvuAwuw7urdNXb3Lkp8tka2qMgfB8bHBiediv5v4Eou1zlHbzEFFv2M6x3Zu QNzRQYJ5rX2WUDvksW3Ob1ow/Z8ANPrt99eiOkW/bshTgN86ifZjxehnXK5pXzYy8oj0 v6JUCbx4OihMsBSWF5rH16GX6cUDKppZcSU6s67/1sn/f7r3Q9UxdiEtti9eUc8OYEJP gg05GMgrBABKXBDhO9lvvPjrlo3L49umPQj4nsB/beiZhNYQmHk13moiV4YTp0Gd1rtW x1Ng== X-Gm-Message-State: APjAAAWZ3gRY7Dyilfo4UrtOGXSHFcT04bsnu+kS/94bpnWFmH+VQt16 6uR81+Cfd8TJsZczymh8wb1zD2NS X-Google-Smtp-Source: APXvYqw/NFx28ZQsb8UcGDLPlgaXYG3jZsCd5B7DO4nbNs8gBYt3gHrhXZQNFirYUZYAYjMRzQAAUw== X-Received: by 2002:a05:620a:14bc:: with SMTP id x28mr44685354qkj.116.1564518117324; Tue, 30 Jul 2019 13:21:57 -0700 (PDT) Received: from localhost.localdomain ([191.83.214.187]) by smtp.gmail.com with ESMTPSA id r36sm35243859qte.71.2019.07.30.13.21.56 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 30 Jul 2019 13:21:56 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Tue, 30 Jul 2019 17:19:47 -0300 Message-Id: <20190730201951.2033-4-jamrial@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190730201951.2033-1-jamrial@gmail.com> References: <20190730201951.2033-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/7] avforamt/av1: combine high_bitdepth and twelve_bit into a single bitdepth value 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" Signed-off-by: James Almer --- libavformat/av1.c | 15 +++++++++------ libavformat/av1.h | 3 +-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/libavformat/av1.c b/libavformat/av1.c index 43e40453c8..b36c5e44ba 100644 --- a/libavformat/av1.c +++ b/libavformat/av1.c @@ -94,9 +94,12 @@ static inline void uvlc(GetBitContext *gb) static int parse_color_config(AV1SequenceParameters *seq_params, GetBitContext *gb) { - seq_params->high_bitdepth = get_bits1(gb); - if (seq_params->profile == FF_PROFILE_AV1_PROFESSIONAL && seq_params->high_bitdepth) - seq_params->twelve_bit = get_bits1(gb); + int twelve_bit = 0; + int high_bitdepth = get_bits1(gb); + if (seq_params->profile == FF_PROFILE_AV1_PROFESSIONAL && high_bitdepth) + twelve_bit = get_bits1(gb); + + seq_params->bitdepth = 8 + (high_bitdepth * 2) + (twelve_bit * 2); if (seq_params->profile == FF_PROFILE_AV1_HIGH) seq_params->monochrome = 0; @@ -135,7 +138,7 @@ static int parse_color_config(AV1SequenceParameters *seq_params, GetBitContext * seq_params->chroma_subsampling_x = 0; seq_params->chroma_subsampling_y = 0; } else { - if (seq_params->twelve_bit) { + if (twelve_bit) { seq_params->chroma_subsampling_x = get_bits1(gb); if (seq_params->chroma_subsampling_x) seq_params->chroma_subsampling_y = get_bits1(gb); @@ -383,8 +386,8 @@ int ff_isom_write_av1c(AVIOContext *pb, const uint8_t *buf, int size) put_bits(&pbc, 3, seq_params.profile); put_bits(&pbc, 5, seq_params.level); put_bits(&pbc, 1, seq_params.tier); - put_bits(&pbc, 1, seq_params.high_bitdepth); - put_bits(&pbc, 1, seq_params.twelve_bit); + put_bits(&pbc, 1, seq_params.bitdepth > 8); + put_bits(&pbc, 1, seq_params.bitdepth == 12); put_bits(&pbc, 1, seq_params.monochrome); put_bits(&pbc, 1, seq_params.chroma_subsampling_x); put_bits(&pbc, 1, seq_params.chroma_subsampling_y); diff --git a/libavformat/av1.h b/libavformat/av1.h index c07fb740e9..9354889afe 100644 --- a/libavformat/av1.h +++ b/libavformat/av1.h @@ -29,8 +29,7 @@ typedef struct AV1SequenceParameters { uint8_t profile; uint8_t level; uint8_t tier; - uint8_t high_bitdepth; - uint8_t twelve_bit; + uint8_t bitdepth; uint8_t monochrome; uint8_t chroma_subsampling_x; uint8_t chroma_subsampling_y;