From patchwork Fri Nov 20 07:18:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 23760 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 DEB0744A644 for ; Fri, 20 Nov 2020 09:24:40 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C67CC68BA1A; Fri, 20 Nov 2020 09:24:40 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7B80268B989 for ; Fri, 20 Nov 2020 09:24:31 +0200 (EET) Received: by mail-ej1-f50.google.com with SMTP id lv15so5640471ejb.12 for ; Thu, 19 Nov 2020 23:24:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references:reply-to :mime-version:content-transfer-encoding; bh=kjW/TQethMTVw6FJEy4ZYuaAnJfxQU+rp7f29klMYLU=; b=slDrFIgHyTsDNlO6UweRvthKCAflbbkLOD2faeA+G/6zv+KusSTFfRMmviUd3+Exe+ 56OGMg7DbiK3zZKAO0dOG2bagNtPWx1a3xiBvm2tmjTZiMgeQaMFE4eBm+i3041m2gpq 1wd/x8WrYcfzADLE/4sAqiS1zK/4OQmuuVh9G6jod9z3+/UBZATwcnge5/zHb81Fn75o ukODnBzxkasHAX/yKOFAxwwK/PNfXcmhv09W5BsOrhgAM+AcoSOXrQyP1izhxfhahLJr y9pHjgIEdoHpD0gmZ1smXMsC+F7NGEh2P6vuod4Z9Tb92ZVvGHsy59dDSbmKB45llrOk wTPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:reply-to:mime-version:content-transfer-encoding; bh=kjW/TQethMTVw6FJEy4ZYuaAnJfxQU+rp7f29klMYLU=; b=l7Qh61pG+8Z3U7YKmapV4CprG0h5nwpNJqOPCBxFKl6HTBI3duQdv3ahn/LmsBHYE3 iA48dwwFseyZtMk262zPc8/19e//n3PTfzk8B7JxOlScd1BzydC/j+/s9ZEwAo1qGCf/ noO/3qHnAO2hyGNb3uJJkhJG87urJQa6eFCj7JF0+Y8GlApEocoQ4KDvJhM2Oo5Tbg/j EI0vL6f/cnqBQMoBar44KiIP0F/N88SblK+LmR4A1vvjJn3Pw5vRE7PU2H/KzjtakqyA O7tKE3mDqaLcU0qyowJP38QdsGMVc1S8QeKBkUswQWro5KvxyAin3nvIsnKkQeMSuVrh /5Gg== X-Gm-Message-State: AOAM532Ef7gBwF11swLb90mDuAUPmW3nQrgCNO1xY2r65bG09mDBGFda TU++I47sD9fLmR373xcrpVlCLUtjCVGvXA== X-Google-Smtp-Source: ABdhPJxdVvWroBU/I+W9CtJ+kCuZMDYzv5c7Gg2F+PITj/S+UhOjOzg+MVjb1nw5t+AXzJ8B3FXTSA== X-Received: by 2002:a17:906:8282:: with SMTP id h2mr32897143ejx.50.1605857069854; Thu, 19 Nov 2020 23:24:29 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id lz27sm779419ejb.39.2020.11.19.23.24.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Nov 2020 23:24:29 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 20 Nov 2020 08:18:54 +0100 Message-Id: <20201120072116.818090-22-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201120072116.818090-1-andreas.rheinhardt@gmail.com> References: <20201120072116.818090-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 021/162] avcodec/clearvideo: Apply VLC offset during init 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Andreas Rheinhardt --- libavcodec/clearvideo.c | 7 +++-- libavcodec/clearvideodata.h | 54 ++++++++++++++----------------------- 2 files changed, 23 insertions(+), 38 deletions(-) diff --git a/libavcodec/clearvideo.c b/libavcodec/clearvideo.c index a5f9cc3ca2..ff6445b1de 100644 --- a/libavcodec/clearvideo.c +++ b/libavcodec/clearvideo.c @@ -88,7 +88,6 @@ static inline int decode_block(CLVContext *ctx, int16_t *blk, int has_ac, memset(blk, 0, sizeof(*blk) * 64); blk[0] = get_vlc2(gb, ctx->dc_vlc.table, CLV_VLC_BITS, 3); - blk[0] -= 63; if (!has_ac) return 0; @@ -712,9 +711,9 @@ static av_cold int clv_decode_init(AVCodecContext *avctx) return AVERROR(ENOMEM); ff_idctdsp_init(&c->idsp, avctx); - ret = init_vlc(&c->dc_vlc, CLV_VLC_BITS, NUM_DC_CODES, - clv_dc_bits, 1, 1, - clv_dc_codes, 1, 1, 0); + ret = ff_init_vlc_from_lengths(&c->dc_vlc, CLV_VLC_BITS, NUM_DC_CODES, + clv_dc_lens, 1, + clv_dc_syms, 1, 1, -63, 0, avctx); if (ret) { av_log(avctx, AV_LOG_ERROR, "Error initialising DC VLC\n"); return ret; diff --git a/libavcodec/clearvideodata.h b/libavcodec/clearvideodata.h index 89bf192bce..37d5eb3bb5 100644 --- a/libavcodec/clearvideodata.h +++ b/libavcodec/clearvideodata.h @@ -28,42 +28,28 @@ #define NUM_DC_CODES 127 #define NUM_AC_CODES 104 -static const uint8_t clv_dc_codes[NUM_DC_CODES] = { - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, - 0x10, 0x11, 0x12, 0x13, 0x13, 0x14, 0x07, 0x0B, - 0x0C, 0x08, 0x08, 0x09, 0x04, 0x06, 0x07, 0x05, - 0x04, 0x05, 0x04, 0x06, 0x05, 0x06, 0x07, 0x05, - 0x06, 0x07, 0x06, 0x07, 0x08, 0x06, 0x07, 0x08, - 0x09, 0x0A, 0x0B, 0x07, 0x08, 0x09, 0x07, 0x08, - 0x06, 0x07, 0x08, 0x06, 0x04, 0x05, 0x02, 0x01, - 0x03, 0x06, 0x07, 0x07, 0x09, 0x0A, 0x0B, 0x09, - 0x0A, 0x0B, 0x0A, 0x0B, 0x0C, 0x0D, 0x0C, 0x09, - 0x0D, 0x0A, 0x0B, 0x08, 0x09, 0x0A, 0x0B, 0x07, - 0x08, 0x09, 0x0A, 0x0B, 0x06, 0x07, 0x06, 0x08, - 0x07, 0x09, 0x0A, 0x0B, 0x09, 0x0A, 0x0B, 0x0C, - 0x14, 0x0D, 0x0D, 0x0E, 0x0F, 0x15, 0x15, 0x16, - 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, - 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, +static const uint8_t clv_dc_lens[NUM_DC_CODES] = { + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 21, 21, 21, 20, 20, 20, 19, 19, 19, 19, 19, 19, 19, 19, 19, 18, 18, 18, 18, + 17, 17, 17, 17, 16, 16, 16, 15, 15, 15, 15, 14, 14, 14, 14, 14, 14, 14, 14, + 13, 13, 12, 12, 12, 12, 12, 12, 12, 12, 11, 11, 11, 11, 11, 11, 10, 10, 10, + 10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 7, 7, + 7, 7, 7, 7, 6, 6, 5, 5, 5, 5, 3, 3, 1, }; -static const uint8_t clv_dc_bits[NUM_DC_CODES] = { - 22, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 21, 22, 22, 19, 20, - 20, 19, 18, 18, 15, 17, 17, 16, - 14, 15, 12, 13, 14, 14, 14, 12, - 12, 12, 11, 11, 11, 10, 10, 10, - 10, 10, 10, 9, 9, 9, 8, 8, - 7, 7, 7, 6, 5, 5, 3, 1, - 3, 5, 5, 6, 7, 7, 7, 8, - 8, 8, 9, 9, 9, 9, 10, 11, - 10, 11, 11, 12, 12, 12, 12, 13, - 14, 14, 14, 14, 15, 15, 16, 17, - 16, 17, 18, 18, 19, 19, 19, 19, - 21, 19, 20, 19, 19, 21, 22, 22, - 22, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 22, 22, 22, +static const uint8_t clv_dc_syms[NUM_DC_CODES] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, + 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x14, 0x15, 0x6E, 0x6F, 0x70, + 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, + 0x7D, 0x7E, 0x13, 0x68, 0x6D, 0x17, 0x18, 0x6A, 0x16, 0x19, 0x64, 0x65, + 0x66, 0x67, 0x69, 0x6B, 0x6C, 0x1A, 0x1B, 0x62, 0x63, 0x1D, 0x1E, 0x5F, + 0x61, 0x1F, 0x5E, 0x60, 0x1C, 0x21, 0x5C, 0x5D, 0x20, 0x24, 0x25, 0x26, + 0x58, 0x59, 0x5A, 0x5B, 0x23, 0x57, 0x22, 0x27, 0x28, 0x29, 0x53, 0x54, + 0x55, 0x56, 0x2A, 0x2B, 0x2C, 0x4F, 0x51, 0x52, 0x2D, 0x2E, 0x2F, 0x30, + 0x31, 0x32, 0x4E, 0x50, 0x33, 0x34, 0x35, 0x4A, 0x4B, 0x4C, 0x4D, 0x36, + 0x37, 0x47, 0x48, 0x49, 0x38, 0x39, 0x3A, 0x44, 0x45, 0x46, 0x3B, 0x43, + 0x3C, 0x3D, 0x41, 0x42, 0x3E, 0x40, 0x3F, }; static const uint16_t clv_ac_syms[NUM_AC_CODES] = {