On Wed, Jan 02, 2019 at 06:12:08PM -0300, James Almer wrote:
> On 1/2/2019 3:53 PM, Paul B Mahol wrote:
> > +static int hcom_decode(AVCodecContext *avctx, void *data,
> > + int *got_frame, AVPacket *pkt)
> > +{
> > + HCOMContext *s = avctx->priv_data;
> > + AVFrame *frame = data;
> > + GetByteContext gb;
> > + uint32_t current;
> > + int ret, n = 0;
> > +
> > + if (pkt->size > INT16_MAX)
> > + return AVERROR_INVALIDDATA;
> > +
> > + frame->nb_samples = pkt->size * 8;
> > + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
> > + return ret;
> > +
> > + bytestream2_init(&gb, pkt->data, pkt->size);
> > + while (bytestream2_get_bytes_left(&gb) >= 4) {
> > + int bits = 32;
> > +
> > + current = bytestream2_get_be32(&gb);
> > +
> > + while (bits-- > 0) {
> > +
> > + if (current & 0x80000000) {
> > + s->dict_entry = s->dict[s->dict_entry].r;
> > + } else {
> > + s->dict_entry = s->dict[s->dict_entry].l;
> > + }
> > +
> > + current = current << 1;
>
> This sounds like get_bits is a better fit than bytestream2 for this decoder.this looks like a standard vlc/huffman reader and could be using the existing vlc code (init_vlc / get_vlc2 / ...) thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I am the wisest man alive, for I know one thing, and that is that I know nothing. -- Socrates
signature.asc
Description: PGP signature
_______________________________________________ ffmpeg-devel mailing list [email protected] http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
