From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id C5B514449D for ; Sat, 12 Nov 2022 16:42:21 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A13D868B898; Sat, 12 Nov 2022 18:42:17 +0200 (EET) Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7370A689EE9 for ; Sat, 12 Nov 2022 18:42:11 +0200 (EET) Received: (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id 5556FE0005 for ; Sat, 12 Nov 2022 16:42:10 +0000 (UTC) Date: Sat, 12 Nov 2022 17:42:09 +0100 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20221112164209.GE1814017@pb2> References: <1d90cbd18bffe5fc8d99ce361dec253c1728e19d.1668213509.git.pross@xvid.org> MIME-Version: 1.0 In-Reply-To: <1d90cbd18bffe5fc8d99ce361dec253c1728e19d.1668213509.git.pross@xvid.org> Subject: Re: [FFmpeg-devel] [PATCH] avcodec: LEAD MCMP decoder 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 Content-Type: multipart/mixed; boundary="===============4853921558604795014==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============4853921558604795014== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="qsoMWdMv/ifdm7CC" Content-Disposition: inline --qsoMWdMv/ifdm7CC Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Nov 12, 2022 at 11:39:19AM +1100, Peter Ross wrote: > Partially fixes ticket #798 > --- >=20 > sample: https://trac.ffmpeg.org/raw-attachment/ticket/798/DaDa_CMP.avi [...] > +static av_cold int lead_decode_init(AVCodecContext * avctx) > +{ > + static AVOnce init_static_once =3D AV_ONCE_INIT; > + LeadContext *s =3D avctx->priv_data; > + > + if (avctx->extradata_size < 20) > + return AVERROR_INVALIDDATA; > + > + ff_idctdsp_init(&s->idsp, avctx); > + ff_permute_scantable(s->permutated_scantable, ff_zigzag_direct, s->i= dsp.idct_permutation); > + > + ff_thread_once(&init_static_once, lead_init_static_data); > + > + return 0; > +} > + > +static void calc_dequant(uint16_t * dequant, const uint8_t * quant_tbl, = int q) > +{ > + for (int i =3D 0; i < 64; i++) > + dequant[i] =3D av_clip(q * quant_tbl[ff_zigzag_direct[i]] / 50, = 2, 32767); > +} > + > +static int decode_block(LeadContext * s, GetBitContext * gb, > + const VLCElem * dc_table, int dc_bits, const VLC= Elem * ac_table, int ac_bits, > + int16_t * dc_pred, const uint16_t * dequant, > + uint8_t * dst, int stride) > +{ > + int16_t block[64]; > + int size; > + > + memset(block, 0, sizeof(block)); clear_block() > + > + size =3D get_vlc2(gb, dc_table, dc_bits, 1); > + if (size < 0) > + return AVERROR_INVALIDDATA; > + > + if (size) > + *dc_pred +=3D get_xbits(gb, size); > + > + block[0] =3D (1 << 10) + *dc_pred * dequant[0]; > + > + for (int i =3D 1; i < 64; i++) { > + int symbol =3D get_vlc2(gb, ac_table, ac_bits, 2); > + if (size < 0) i think you want to check symbol here also if you want you could probably map the unused vlcs to things causing = the i>=3D64 check to fail later to avoid a 2nd check but its probably not worth the work for this codec > + return AVERROR_INVALIDDATA; > + > + if (!symbol) > + break; > + > + i +=3D symbol >> 4; > + if (i >=3D 64) > + return AVERROR_INVALIDDATA; > + > + size =3D symbol & 0xF; > + if (size) > + block[s->permutated_scantable[i]] =3D get_xbits(gb, size) * = dequant[i]; > + } > + > + s->idsp.idct_put(dst, stride, block); void (*idct_put)(uint8_t *dest /* align 8 */, ptrdiff_t line_size, int16_t *block /* align 16 */); block needs to be aligned to 16 bytes [...] thx --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Never trust a computer, one day, it may think you are the virus. -- Compn --qsoMWdMv/ifdm7CC Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEIAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCY2/M2QAKCRBhHseHBAsP q/s8AJ4j4Pc28ozHr+V8Ssc9gbihEUCtrACdHMwRLDN31xR9e53pVz9UdHOxhhg= =MKrK -----END PGP SIGNATURE----- --qsoMWdMv/ifdm7CC-- --===============4853921558604795014== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". --===============4853921558604795014==--