From patchwork Mon Dec 11 01:35:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgQsWTc2No?= X-Patchwork-Id: 45031 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:1225:b0:181:818d:5e7f with SMTP id v37csp2651660pzf; Sun, 10 Dec 2023 17:45:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IEXSwl5fZhUQBJh9PwQL8JcJzBVzLZozqPmYpVWew/ffLpGWUoHzRPO+Qrc0RejwxRrc+F9 X-Received: by 2002:a50:9f26:0:b0:54c:a2f9:5667 with SMTP id b35-20020a509f26000000b0054ca2f95667mr4021381edf.4.1702259125791; Sun, 10 Dec 2023 17:45:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702259125; cv=none; d=google.com; s=arc-20160816; b=NIokVxYCYhl57R5qTVZtMpzcJCpOi0Z6HFuCs6pSslbAFfOR2h6NqkLAadAsKo/hWM SKRNevOU6jdVNpiUlwnCyTUTk6IPV1iGljQGjOCJSoe0PSgZvDV8rE9XPMHJMtN5iHIp lDmTdfOy4oajHqekVelrD4oUaw9ppWPtYrMAtQivLBOTw+ZBfnGDUnaHlaZ3/ksWbmh3 ik+Urn78uZeJ73hW/t0W4S1zjteYI7RUv9YCfgzgY5Op7qk/I5QfxEskrIA8LlOVHMBx S71Ky/HkVpuTIFxsqj07PU3OmUlG0jzm71K3x9NN/BD8s8wygcEjE8RdR2vVKxvvKHqB KCXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=0ZRoK0NfkctREaUWUHxlbvPZE6sjTLoBQfBx+ECwKMI=; fh=Jgo3TCyoG8OdFLqA8BuM7Wbf1w27210JU6p+E8x39/M=; b=V/gQYQqcxFbry4JZ5JuZqWSDmu6yymwgmWc2Tn/0MzFdivPCYtajSJXS3QFw/WVsKT BR5OZ5m9hQxcHD+TRxFjQuNzqP8T2aVgDGAfyQn0YxRSBxoMOUAyZ3rkEhoVqKv5Lbtc 7/RLCsNnfiolhHUiVrtHFLk43Tm4VhcS73KRL3NGzGFPeqEa6AdnyN9fm5U8OFWZOo8k JkINIzRHd1L/8Ue0hXhUESnXFRak4s+5M6hc7yYxekUHt5maHEyXqTIxUQCQ1W3OP95p sXPCujBJuiLi5haqTe3P+cgGlrGUY8IwOdcYEpGD6iuytFS9U4f9IpgNlzXisRJsZ6gr rsBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@pkh.me header.s=selector1 header.b=Y2vi3ull; 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=NONE dis=NONE) header.from=pkh.me Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id n13-20020a05640205cd00b0055130bb29ccsi385534edx.33.2023.12.10.17.45.25; Sun, 10 Dec 2023 17:45:25 -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=@pkh.me header.s=selector1 header.b=Y2vi3ull; 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=NONE dis=NONE) header.from=pkh.me Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1DF8C68D169; Mon, 11 Dec 2023 03:44:56 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from ssq0.pkh.me (laubervilliers-656-1-228-164.w92-154.abo.wanadoo.fr [92.154.28.164]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5129C68D131 for ; Mon, 11 Dec 2023 03:44:50 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pkh.me; s=selector1; t=1702259075; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TTGQGlaPebjX6Exylz6rLw9ed70calRFLHA3vu7ZtI0=; b=Y2vi3ullDp+RZQP/5ehoCVvWPzlGO2UkNRy9JB3NwXbpmAi2WZZhivWswvqKJJ/wu2OLuO S57IOVMcaTfZHKnSACIVR3roi481TVFB3c1VmwRzHptn0F+wf7JScbbveyBOfuuQMLYdfZ tcTSmpzZv+z0pbbGNsHBmOBsZiTr0TM= Received: from localhost (ssq0.pkh.me [local]) by ssq0.pkh.me (OpenSMTPD) with ESMTPA id fa230802; Mon, 11 Dec 2023 01:44:35 +0000 (UTC) From: =?utf-8?b?Q2zDqW1lbnQgQsWTc2No?= To: ffmpeg-devel@ffmpeg.org Date: Mon, 11 Dec 2023 02:35:05 +0100 Message-ID: <20231211014429.1841681-5-u@pkh.me> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231211014429.1841681-1-u@pkh.me> References: <20231211014429.1841681-1-u@pkh.me> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 04/35] avcodec/proresenc_anatoliy: move run/lev to codebook LUT to shared proresdata X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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: =?utf-8?b?Q2zDqW1lbnQgQsWTc2No?= Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: jBaeX6rb67qU This is going to be shared with proresenc_kostya in the upcoming commit. --- libavcodec/proresdata.c | 6 ++++++ libavcodec/proresdata.h | 2 ++ libavcodec/proresenc_anatoliy.c | 9 ++------- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/libavcodec/proresdata.c b/libavcodec/proresdata.c index 4787907c71..12ee43bddd 100644 --- a/libavcodec/proresdata.c +++ b/libavcodec/proresdata.c @@ -43,3 +43,9 @@ const uint8_t ff_prores_interlaced_scan[64] = { 30, 23, 31, 38, 45, 52, 60, 53, 46, 39, 47, 54, 61, 62, 55, 63 }; + +const uint8_t ff_prores_run_to_cb[16] = { 0x06, 0x06, 0x05, 0x05, 0x04, 0x29, + 0x29, 0x29, 0x29, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x4C }; + +const uint8_t ff_prores_lev_to_cb[10] = { 0x04, 0x0A, 0x05, 0x06, 0x04, 0x28, + 0x28, 0x28, 0x28, 0x4C }; diff --git a/libavcodec/proresdata.h b/libavcodec/proresdata.h index d8c8786689..4d16992892 100644 --- a/libavcodec/proresdata.h +++ b/libavcodec/proresdata.h @@ -29,6 +29,8 @@ extern const uint8_t ff_prores_progressive_scan[64]; extern const uint8_t ff_prores_interlaced_scan[64]; +extern const uint8_t ff_prores_run_to_cb[16]; +extern const uint8_t ff_prores_lev_to_cb[10]; #define FIRST_DC_CB 0xB8 // rice_order = 5, exp_golomb_order = 6, switch_bits = 0 diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c index e7114f1646..6b2e513bed 100644 --- a/libavcodec/proresenc_anatoliy.c +++ b/libavcodec/proresenc_anatoliy.c @@ -296,11 +296,6 @@ static void encode_dc_coeffs(PutBitContext *pb, int16_t *in, } } -static const uint8_t run_to_cb[16] = { 0x06, 0x06, 0x05, 0x05, 0x04, 0x29, - 0x29, 0x29, 0x29, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x4C }; -static const uint8_t lev_to_cb[10] = { 0x04, 0x0A, 0x05, 0x06, 0x04, 0x28, - 0x28, 0x28, 0x28, 0x4C }; - static void encode_ac_coeffs(PutBitContext *pb, int16_t *in, int blocks_per_slice, int *qmat, const uint8_t ff_prores_scan[64]) { @@ -313,14 +308,14 @@ static void encode_ac_coeffs(PutBitContext *pb, for (j = 0; j < blocks_per_slice; j++) { int val = QSCALE(qmat, indp, in[(j << 6) + indp]); if (val) { - encode_codeword(pb, run, run_to_cb[FFMIN(prev_run, 15)]); + encode_codeword(pb, run, ff_prores_run_to_cb[FFMIN(prev_run, 15)]); prev_run = run; run = 0; level = get_level(val); code = level - 1; - encode_codeword(pb, code, lev_to_cb[FFMIN(prev_level, 9)]); + encode_codeword(pb, code, ff_prores_lev_to_cb[FFMIN(prev_level, 9)]); prev_level = level;