From patchwork Fri Nov 20 07:19:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 23839 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 92658448F87 for ; Fri, 20 Nov 2020 09:40:08 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4EF7268BBE3; Fri, 20 Nov 2020 09:25:57 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7933768BB43 for ; Fri, 20 Nov 2020 09:25:37 +0200 (EET) Received: by mail-ej1-f44.google.com with SMTP id o21so11496522ejb.3 for ; Thu, 19 Nov 2020 23:25:37 -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=CZX93qf0S9OT9q+T+Ie+0kn1CGoqWml0yM46YIG31Is=; b=CbEtaZUyO2rtExYUSHg4HHTCCdCYnSjRunqL7ha4ike2DVdiVWOql9WUaTdjihVHv5 4O6YRq5t4eyE9dQrryVBRfClwIFR70pr7Aywmgmo+XP/Cp0yPsk3Yg2WeTLv/wlHEvXQ ZZ3+V2BwCeIIbcvOHkyFFFFFAxYup19tcjYm1sq2lucakTEhRG0hHHQBdsVNELnGC0ow VbDLvbA4mfHqeNJ7bA3jAQnoFQGP7KODdw71WbpCEdUqPx/Y+iH++86ANn5dHsBjEOdB GZE2DCp8B5e5UJ8d8HlTgMrgQ41S/2FGCp0+o2bqy693DlttxR7NjtBjdKMmoeuJSLtF 2mJQ== 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=CZX93qf0S9OT9q+T+Ie+0kn1CGoqWml0yM46YIG31Is=; b=f+yGlARUFuMnyetHbW5A/pW/EkIqdow3jeukAYkEixJY4rK+FeW5C8E7aAO+RiyKIl nUBDp0pAwlvq1/rrfsJCsEeprI7Pp0n6ubML8vfkamNJEHnL0B1UOvR3tV9dmuingehT E9OHT+qgd9dCpEmE0J/2kGkAXSDyI0aWPb6s+58YhCiv5R7zJwIa1jxoqGkP9eWoVdKa M6TM5ozAJFe+K2uZHVqUCcKe9o10QHSiYXUmovPiVgiN3KGMg7yEeCMPBGD33GK75b4L PkzIAPrl5ogu7RltM+iajiFHM5uePt924c8hIg9+YG12Ij1A77l+qbVLQA9RDDSKxZu/ BXXw== X-Gm-Message-State: AOAM530fptKUcQFRym1bdQev8Afu4fKgW4UeqaiMcnng4x52qwJRQf0d a9kRKR+A79hdSlR3ko+0iz3cbYhRux7KiQ== X-Google-Smtp-Source: ABdhPJyLqGDL8ZCw37LhWI+xUNDtaFzAwgQTDBltps/dR9Hnw69mp+wyLSwx3IQkBt0InQwBgQBiWw== X-Received: by 2002:a17:906:7d1:: with SMTP id m17mr31862812ejc.98.1605857136293; Thu, 19 Nov 2020 23:25:36 -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.25.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Nov 2020 23:25:35 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 20 Nov 2020 08:19:59 +0100 Message-Id: <20201120072116.818090-87-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 086/162] avcodec/mpeg4video: Make tables used to initialize VLCs smaller 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" Switching from ff_init_vlc_sparse() to ff_init_vlc_from_lengths() allows to replace codes which are so long that they need to be stored in an uint16_t by symbols which fit into an uint8_t; and even these can be avoided in case of the sprite trajectory VLC. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpeg4data.h | 150 +++++++++++++++---------------------- libavcodec/mpeg4video.h | 8 +- libavcodec/mpeg4videodec.c | 31 ++++---- 3 files changed, 80 insertions(+), 109 deletions(-) diff --git a/libavcodec/mpeg4data.h b/libavcodec/mpeg4data.h index 4756e9ea1d..30179d9801 100644 --- a/libavcodec/mpeg4data.h +++ b/libavcodec/mpeg4data.h @@ -323,10 +323,8 @@ RLTable ff_rvlc_rl_intra = { intra_rvlc_level, }; -const uint16_t ff_sprite_trajectory_tab[15][2] = { - {0x00, 2}, {0x02, 3}, {0x03, 3}, {0x04, 3}, {0x05, 3}, {0x06, 3}, - {0x0E, 4}, {0x1E, 5}, {0x3E, 6}, {0x7E, 7}, {0xFE, 8}, - {0x1FE, 9},{0x3FE, 10},{0x7FE, 11},{0xFFE, 12}, +const uint8_t ff_sprite_trajectory_lens[15] = { + 2, 3, 3, 3, 3, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, }; const uint8_t ff_mb_type_b_tab[4][2] = { @@ -374,119 +372,91 @@ const uint8_t ff_mpeg4_dc_threshold[8]={ }; /* Note these are different in studio mode */ -const uint16_t ff_mpeg4_studio_dc_luma[19][2]={ - {0x0e, 6}, {0x06, 5}, {0x00, 4}, {0x02, 4}, - {0x07, 3}, {0x05, 3}, {0x03, 3}, {0x02, 3}, - {0x04, 3}, {0x06, 3}, {0x01, 4}, {0x1e, 7}, - {0x3e, 8}, {0x7e, 9}, {0xfe, 10}, {0x1fe, 11}, - {0x3fe, 12}, {0x7fe, 13}, {0x7ff, 13} +const uint8_t ff_mpeg4_studio_dc_luma[19][2] = { + { 2, 4 }, { 10, 4 }, { 3, 4 }, { 1, 5 }, { 0, 6 }, { 11, 7 }, + { 12, 8 }, { 13, 9 }, { 14, 10 }, { 15, 11 }, { 16, 12 }, { 17, 13 }, + { 18, 13 }, { 7, 3 }, { 6, 3 }, { 8, 3 }, { 5, 3 }, { 9, 3 }, + { 4, 3 }, }; -const uint16_t ff_mpeg4_studio_dc_chroma[19][2]={ - {0x00, 4}, {0x02, 4}, {0x07, 3}, {0x05, 3}, - {0x03, 3}, {0x02, 3}, {0x04, 3}, {0x06, 3}, - {0x01, 4}, {0x06, 5}, {0x0e, 6}, {0x1e, 7}, - {0x3e, 8}, {0x7e, 9}, {0xfe, 10}, {0x1fe, 11}, - {0x3fe, 12}, {0x7fe, 13}, {0x7ff, 13} +const uint8_t ff_mpeg4_studio_dc_chroma[19][2] = { + { 0, 4 }, { 8, 4 }, { 1, 4 }, { 9, 5 }, { 10, 6 }, { 11, 7 }, + { 12, 8 }, { 13, 9 }, { 14, 10 }, { 15, 11 }, { 16, 12 }, { 17, 13 }, + { 18, 13 }, { 5, 3 }, { 4, 3 }, { 6, 3 }, { 3, 3 }, { 7, 3 }, + { 2, 3 }, }; -const uint16_t ff_mpeg4_studio_intra[12][22][2]={ +const uint8_t ff_mpeg4_studio_intra[12][24][2] = { { - {0x05, 4}, {0x04, 4}, {0x05, 7}, {0x09, 9}, - {0x21, 11}, {0x41, 12}, {0x81, 13}, {0x03, 4}, - {0x03, 5}, {0x05, 6}, {0x04, 7}, {0x03, 7}, - {0x05, 8}, {0x03, 2}, {0x05, 3}, {0x04, 3}, - {0x03, 3}, {0x02, 4}, {0x04, 6}, {0x03, 6}, - {0x11, 10}, {0x80, 13} + { 0, -6 }, { 21, 13 }, { 6, 13 }, { 5, 12 }, { 4, 11 }, { 20, 10 }, + { 3, 9 }, { 12, 8 }, { 11, 7 }, { 10, 7 }, { 2, 7 }, { 19, 6 }, + { 18, 6 }, { 9, 6 }, { 8, 5 }, { 17, 4 }, { 7, 4 }, { 1, 4 }, + { 0, 4 }, { 16, 3 }, { 15, 3 }, { 14, 3 }, { 13, 2 }, }, { - {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}, - {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}, - {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}, - {0x00, 0}, {0x00, 0}, {0x01, 1}, {0x01, 2}, - {0x01, 3}, {0x01, 4}, {0x01, 5}, {0x03, 7}, - {0x05, 8}, {0x04, 8} + { 0, -6 }, { 21, 8 }, { 20, 8 }, { 19, 7 }, { 18, 5 }, { 17, 4 }, + { 16, 3 }, { 15, 2 }, { 14, 1 }, }, { - {0x05, 3}, {0x03, 5}, {0x02, 5}, {0x03, 7}, - {0x09, 9}, {0x103, 14}, {0x102, 14}, {0x04, 3}, - {0x03, 3}, {0x03, 4}, {0x02, 4}, {0x03, 6}, - {0x11, 10}, {0x03, 2}, {0x02, 3}, {0x02, 6}, - {0x05, 8}, {0x21, 11}, {0x83, 13}, {0x101, 14}, - {0x201, 15}, {0x82, 13} + { 0, -6 }, { 0,-15 }, { 20, 15 }, { 19, 14 }, { 6, 14 }, { 5, 14 }, + { 21, 13 }, { 18, 13 }, { 17, 11 }, { 12, 10 }, { 4, 9 }, { 16, 8 }, + { 3, 7 }, { 15, 6 }, { 11, 6 }, { 2, 5 }, { 1, 5 }, { 10, 4 }, + { 9, 4 }, { 14, 3 }, { 8, 3 }, { 7, 3 }, { 0, 3 }, { 13, 2 }, }, { - {0x05, 5}, {0x05, 4}, {0x04, 5}, {0x03, 6}, - {0x09, 9}, {0x83, 13}, {0x82, 13}, {0x03, 3}, - {0x04, 4}, {0x03, 4}, {0x03, 5}, {0x05, 8}, - {0x81, 13}, {0x03, 2}, {0x02, 2}, {0x02, 5}, - {0x02, 6}, {0x03, 7}, {0x11, 10}, {0x43, 12}, - {0x80, 13}, {0x42, 12} + { 0, -6 }, { 20, 13 }, { 12, 13 }, { 6, 13 }, { 5, 13 }, { 21, 12 }, + { 19, 12 }, { 18, 10 }, { 4, 9 }, { 11, 8 }, { 17, 7 }, { 16, 6 }, + { 3, 6 }, { 15, 5 }, { 10, 5 }, { 2, 5 }, { 0, 5 }, { 9, 4 }, + { 8, 4 }, { 1, 4 }, { 7, 3 }, { 14, 2 }, { 13, 2 }, }, { - {0x05, 7}, {0x03, 4}, {0x03, 5}, {0x04, 7}, - {0x09, 9}, {0x83, 13}, {0x101, 14}, {0x03, 3}, - {0x02, 4}, {0x05, 6}, {0x03, 7}, {0x11, 10}, - {0x201, 15}, {0x03, 2}, {0x02, 2}, {0x02, 3}, - {0x04, 6}, {0x03, 6}, {0x05, 8}, {0x21, 11}, - {0x82, 13}, {0x81, 13} + { 0, -6 }, { 0,-15 }, { 12, 15 }, { 6, 14 }, { 21, 13 }, { 20, 13 }, + { 5, 13 }, { 19, 11 }, { 11, 10 }, { 4, 9 }, { 18, 8 }, { 10, 7 }, + { 3, 7 }, { 0, 7 }, { 17, 6 }, { 16, 6 }, { 9, 6 }, { 2, 5 }, + { 8, 4 }, { 1, 4 }, { 15, 3 }, { 7, 3 }, { 14, 2 }, { 13, 2 }, }, { - {0x13, 10}, {0x03, 5}, {0x05, 7}, {0x12, 10}, - {0x43, 12}, {0x83, 13}, {0x82, 13}, {0x02, 5}, - {0x04, 7}, {0x05, 8}, {0x23, 11}, {0x81, 13}, - {0x101, 14}, {0x03, 2}, {0x02, 2}, {0x01, 2}, - {0x01, 3}, {0x03, 6}, {0x03, 7}, {0x22, 11}, - {0x201, 15}, {0x42, 12} + { 0, -6 }, { 0,-15 }, { 20, 15 }, { 12, 14 }, { 11, 13 }, { 6, 13 }, + { 5, 13 }, { 21, 12 }, { 4, 12 }, { 19, 11 }, { 10, 11 }, { 3, 10 }, + { 0, 10 }, { 9, 8 }, { 18, 7 }, { 8, 7 }, { 2, 7 }, { 17, 6 }, + { 7, 5 }, { 1, 5 }, { 16, 3 }, { 15, 2 }, { 14, 2 }, { 13, 2 }, }, { - {0x23, 11}, {0x01, 4}, {0x07, 8}, {0x13, 10}, - {0x22, 11}, {0x103, 14}, {0x102, 14}, {0x03, 6}, - {0x06, 8}, {0x12, 10}, {0x43, 12}, {0x101, 14}, - {0x201, 15}, {0x03, 3}, {0x02, 3}, {0x03, 2}, - {0x02, 2}, {0x01, 3}, {0x02, 6}, {0x05, 8}, - {0x42, 12}, {0x41, 12} + { 0, -6 }, { 0,-15 }, { 12, 15 }, { 11, 14 }, { 6, 14 }, { 5, 14 }, + { 21, 12 }, { 20, 12 }, { 10, 12 }, { 4, 11 }, { 0, 11 }, { 9, 10 }, + { 3, 10 }, { 19, 8 }, { 8, 8 }, { 2, 8 }, { 18, 6 }, { 7, 6 }, + { 1, 4 }, { 17, 3 }, { 14, 3 }, { 13, 3 }, { 16, 2 }, { 15, 2 }, }, { - {0x0b, 9}, {0x03, 5}, {0x07, 8}, {0x07, 7}, - {0x06, 7}, {0x23, 11}, {0x41, 12}, {0x05, 7}, - {0x06, 8}, {0x0a, 9}, {0x13, 10}, {0x22, 11}, - {0x40, 12}, {0x03, 4}, {0x02, 4}, {0x03, 2}, - {0x02, 2}, {0x01, 2}, {0x02, 5}, {0x04, 7}, - {0x12, 10}, {0x21, 11} + { 0, -6 }, { 12, 12 }, { 6, 12 }, { 21, 11 }, { 11, 11 }, { 5, 11 }, + { 20, 10 }, { 10, 10 }, { 9, 9 }, { 0, 9 }, { 8, 8 }, { 2, 8 }, + { 19, 7 }, { 7, 7 }, { 4, 7 }, { 3, 7 }, { 18, 5 }, { 1, 5 }, + { 14, 4 }, { 13, 4 }, { 17, 2 }, { 16, 2 }, { 15, 2 }, }, { - {0x15, 10}, {0x03, 6}, {0x14, 10}, {0x23, 11}, - {0x07, 8}, {0x43, 12}, {0x81, 13}, {0x06, 8}, - {0x0b, 9}, {0x13, 10}, {0x12, 10}, {0x42, 12}, - {0x80, 13}, {0x01, 4}, {0x03, 3}, {0x02, 3}, - {0x03, 2}, {0x02, 2}, {0x01, 3}, {0x02, 6}, - {0x22, 11}, {0x41, 12} + { 0, -6 }, { 12, 13 }, { 6, 13 }, { 21, 12 }, { 11, 12 }, { 5, 12 }, + { 20, 11 }, { 3, 11 }, { 10, 10 }, { 9, 10 }, { 2, 10 }, { 0, 10 }, + { 8, 9 }, { 7, 8 }, { 4, 8 }, { 19, 6 }, { 1, 6 }, { 13, 4 }, + { 18, 3 }, { 15, 3 }, { 14, 3 }, { 17, 2 }, { 16, 2 }, }, { - {0x43, 12}, {0x05, 6}, {0x07, 8}, {0x04, 6}, - {0x03, 6}, {0x13, 10}, {0x42, 12}, {0x05, 7}, - {0x04, 7}, {0x06, 8}, {0x12, 10}, {0x41, 12}, - {0x40, 12}, {0x03, 5}, {0x03, 4}, {0x03, 3}, - {0x02, 3}, {0x03, 2}, {0x02, 2}, {0x02, 4}, - {0x05, 8}, {0x11, 10} + { 0, -6 }, { 12, 12 }, { 11, 12 }, { 6, 12 }, { 0, 12 }, { 21, 10 }, + { 10, 10 }, { 5, 10 }, { 20, 8 }, { 9, 8 }, { 2, 8 }, { 8, 7 }, + { 7, 7 }, { 4, 6 }, { 3, 6 }, { 1, 6 }, { 13, 5 }, { 19, 4 }, + { 14, 4 }, { 16, 3 }, { 15, 3 }, { 18, 2 }, { 17, 2 }, }, { - {0x83, 13}, {0x05, 7}, {0x07, 8}, {0x03, 4}, - {0x21, 11}, {0x82, 13}, {0x81, 13}, {0x04, 7}, - {0x06, 8}, {0x0b, 9}, {0x0a, 9}, {0x11, 10}, - {0x80, 13}, {0x03, 5}, {0x02, 5}, {0x02, 4}, - {0x03, 3}, {0x02, 3}, {0x03, 2}, {0x02, 2}, - {0x03, 6}, {0x09, 9} + { 0, -6 }, { 12, 13 }, { 6, 13 }, { 5, 13 }, { 0, 13 }, { 4, 11 }, + { 11, 10 }, { 21, 9 }, { 10, 9 }, { 9, 9 }, { 8, 8 }, { 2, 8 }, + { 7, 7 }, { 1, 7 }, { 20, 6 }, { 14, 5 }, { 13, 5 }, { 15, 4 }, + { 3, 4 }, { 17, 3 }, { 16, 3 }, { 19, 2 }, { 18, 2 }, }, { - {0x13, 10}, {0x03, 5}, {0x03, 6}, {0x0d, 9}, - {0x0c, 9}, {0x21, 11}, {0x20, 11}, {0x02, 5}, - {0x02, 6}, {0x07, 8}, {0x0b, 9}, {0x12, 10}, - {0x11, 10}, {0x05, 3}, {0x04, 3}, {0x05, 4}, - {0x04, 4}, {0x03, 4}, {0x02, 4}, {0x03, 3}, - {0x03, 2}, {0x0a, 9} - } + { 0, -6 }, { 6, 11 }, { 5, 11 }, { 12, 10 }, { 11, 10 }, { 0, 10 }, + { 21, 9 }, { 10, 9 }, { 4, 9 }, { 3, 9 }, { 9, 8 }, { 8, 6 }, + { 2, 6 }, { 7, 5 }, { 1, 5 }, { 18, 4 }, { 17, 4 }, { 16, 4 }, + { 15, 4 }, { 19, 3 }, { 14, 3 }, { 13, 3 }, { 20, 2 }, + }, }; #endif /* AVCODEC_MPEG4DATA_H */ diff --git a/libavcodec/mpeg4video.h b/libavcodec/mpeg4video.h index 1a5da31928..3de598465f 100644 --- a/libavcodec/mpeg4video.h +++ b/libavcodec/mpeg4video.h @@ -138,7 +138,7 @@ extern RLTable ff_mpeg4_rl_intra; extern RLTable ff_rvlc_rl_inter; extern RLTable ff_rvlc_rl_intra; -extern const uint16_t ff_sprite_trajectory_tab[15][2]; +extern const uint8_t ff_sprite_trajectory_lens[15]; extern const uint8_t ff_mb_type_b_tab[4][2]; /* these matrixes will be permuted for the idct */ @@ -151,9 +151,9 @@ extern const uint16_t ff_mpeg4_resync_prefix[8]; extern const uint8_t ff_mpeg4_dc_threshold[8]; -extern const uint16_t ff_mpeg4_studio_dc_luma[19][2]; -extern const uint16_t ff_mpeg4_studio_dc_chroma[19][2]; -extern const uint16_t ff_mpeg4_studio_intra[12][22][2]; +extern const uint8_t ff_mpeg4_studio_dc_luma[19][2]; +extern const uint8_t ff_mpeg4_studio_dc_chroma[19][2]; +extern const uint8_t ff_mpeg4_studio_intra[12][24][2]; void ff_mpeg4_encode_mb(MpegEncContext *s, int16_t block[6][64], diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index ff5c6acf67..cc3c36d722 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -3394,9 +3394,9 @@ av_cold void ff_mpeg4videodec_static_init(void) { INIT_VLC_STATIC(&dc_chrom, DC_VLC_BITS, 10 /* 13 */, &ff_mpeg4_DCtab_chrom[0][1], 2, 1, &ff_mpeg4_DCtab_chrom[0][0], 2, 1, 512); - INIT_VLC_STATIC(&sprite_trajectory, SPRITE_TRAJ_VLC_BITS, 15, - &ff_sprite_trajectory_tab[0][1], 4, 2, - &ff_sprite_trajectory_tab[0][0], 4, 2, 128); + INIT_VLC_STATIC_FROM_LENGTHS(&sprite_trajectory, SPRITE_TRAJ_VLC_BITS, 15, + ff_sprite_trajectory_lens, 1, + NULL, 0, 0, 0, 0, 128); INIT_VLC_STATIC(&mb_type_b_vlc, MB_TYPE_B_VLC_BITS, 4, &ff_mb_type_b_tab[0][1], 2, 1, &ff_mb_type_b_tab[0][0], 2, 1, 16); @@ -3506,26 +3506,27 @@ static av_cold int init_studio_vlcs(Mpeg4DecContext *ctx) int i, ret; for (i = 0; i < 12; i++) { - ret = init_vlc(&ctx->studio_intra_tab[i], STUDIO_INTRA_BITS, 22, - &ff_mpeg4_studio_intra[i][0][1], 4, 2, - &ff_mpeg4_studio_intra[i][0][0], 4, 2, - 0); + ret = ff_init_vlc_from_lengths(&ctx->studio_intra_tab[i], + STUDIO_INTRA_BITS, 24, + &ff_mpeg4_studio_intra[i][0][1], 2, + &ff_mpeg4_studio_intra[i][0][0], 2, 1, + 0, 0, NULL); if (ret < 0) return ret; } - ret = init_vlc(&ctx->studio_luma_dc, STUDIO_INTRA_BITS, 19, - &ff_mpeg4_studio_dc_luma[0][1], 4, 2, - &ff_mpeg4_studio_dc_luma[0][0], 4, 2, - 0); + ret = ff_init_vlc_from_lengths(&ctx->studio_luma_dc, STUDIO_INTRA_BITS, 19, + &ff_mpeg4_studio_dc_luma[0][1], 2, + &ff_mpeg4_studio_dc_luma[0][0], 2, 1, + 0, 0, NULL); if (ret < 0) return ret; - ret = init_vlc(&ctx->studio_chroma_dc, STUDIO_INTRA_BITS, 19, - &ff_mpeg4_studio_dc_chroma[0][1], 4, 2, - &ff_mpeg4_studio_dc_chroma[0][0], 4, 2, - 0); + ret = ff_init_vlc_from_lengths(&ctx->studio_chroma_dc, STUDIO_INTRA_BITS, 19, + &ff_mpeg4_studio_dc_chroma[0][1], 2, + &ff_mpeg4_studio_dc_chroma[0][0], 2, 1, + 0, 0, NULL); if (ret < 0) return ret;