From patchwork Tue Nov 10 10:48:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 23545 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 0EB5144B2CF for ; Tue, 10 Nov 2020 13:04:48 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4779D68BF49; Tue, 10 Nov 2020 12:50:42 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A120D68BEEB for ; Tue, 10 Nov 2020 12:50:26 +0200 (EET) Received: by mail-wr1-f66.google.com with SMTP id k2so8767983wrx.2 for ; Tue, 10 Nov 2020 02:50:26 -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=UsWV9pf0EZmiWFkvEzsCf0S6NWsywx7oD5NLGgW8Nyw=; b=LU/1Oh/55kzhvlkGMBySJaeTXBSzO/FxQrey0IvGI8NNI9M9L5pjQ7par15LCUo+Wp mxtoMQQOsmHU4o+HrfvzWfaz3kI4HQaOVnn/3ok0nqgFPcE5Vfh5HjqTR1Ohl9so4gqj 2N5qeX55VCGnQIt8kLtbtztg+Jcfq+ZdoFqdHS9cqjhYJ4feSdl2YhOXT07/+zv4QD0k dzg5zH4cFoMVt/bCxK9V2LZvRyxKgaIASp4hKvnvkKDCB53T+fb/38QDV/yOs0zvg+VA +1JivAQYq0ImSsJjWSNx26vgnw3iNgiO2yRpc+NgKpzAqTq2N0iiJKuwEp858vOphRRp f44g== 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=UsWV9pf0EZmiWFkvEzsCf0S6NWsywx7oD5NLGgW8Nyw=; b=sO1VlTveqsIm39HXfFPmzHj7nlIhR5Gebdq7B29lReWgmj1yE5DJRiEXVekvskmQMQ rCYQ4arMh5Ul6JIjMpilkIptkPbzB2UJmiKSWaq4BtydiU/SDLAGNw7IhbWAk4t2ctFu E+wS5GgX2J6NKbzdw4bNsZj6rYXa0zlmrDdT84XTRsJH1nkV08PTKkvGMa7QiqXDI5ZW z6dfxfmOcErrs4RAxMLYgrjqrOf0fKgwWS16V9PsChd7GqE6yroj0zaHb4ZTbQ9ZP882 BUHEc/KJ4+8vIWvxeiJs3Cn/xAeVgVoPD2AcsOB7glLK7p+fQY0h3O4LCkP8ylpV/rvn 4Erw== X-Gm-Message-State: AOAM531+6HYNDPnigWInDVfcoukdmgSUidP7ybddhvFH7lc2I5baI9Sp vBDog0jFe41b2glysptbKR+QD8nm/70= X-Google-Smtp-Source: ABdhPJx50qx9o4ZjcLK4FSZnarlFVEqQCPlAN8pyYxqYx7Wvwx1hVK6pOqE0Nwvq1OJjKeiCjAPGiA== X-Received: by 2002:a05:6000:1c9:: with SMTP id t9mr16870881wrx.379.1605005425427; Tue, 10 Nov 2020 02:50:25 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id l24sm2572543wmi.7.2020.11.10.02.50.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Nov 2020 02:50:24 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 10 Nov 2020 11:48:04 +0100 Message-Id: <20201110104851.321029-68-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201110104851.321029-1-andreas.rheinhardt@gmail.com> References: <20201110104851.321029-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 067/114] 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..a03bd240a8 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); 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); 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); if (ret < 0) return ret;