Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Pierre-Anthony Lemieux <pal@sandflow.com>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH v1 2/3] avcodec/jpeg2000dec: add support for HTJ2K block decoding
Date: Tue, 11 Apr 2023 10:57:33 -0700
Message-ID: <CAF_7JxBdLxxs5v+QC5RysSUuxbDJXfbef1soJwiKwmfj_jbiow@mail.gmail.com> (raw)
In-Reply-To: <e0366892a9f5cfad42b8c75ceae860e6dec1a1a8.camel@haerdin.se>

On Wed, Apr 5, 2023 at 6:45 AM Tomas Härdin <git@haerdin.se> wrote:
>
> ons 2023-04-05 klockan 16:16 +0300 skrev Caleb Etemesi:
> > > > +/*
> > > > + * Copyright 2019 - 2021, Osamu Watanabe
> > >
> > > Is this based on another codebase?
> > >
> > > > + * 2. Redistributions in binary form must reproduce the above
> > > > copyright notice,
> > > > + *    this list of conditions and the following disclaimer in
> > > > the
> > > > documentation
> > > > + *    and/or other materials provided with the distribution.
> > >
> > > Do we do this currently?
> >
> >
> > I'm not sure, haven't seen any part that directly uses someone else's
> > work,
> > the tables
> > were generated for his project so I thought it was sensible to credit
> > him
>
> Definitely do credit. I wonder if there's other files in the project
> with similar licenses and if we do print this stuff.

There are several other files where some of the content originated
from BSD-licensed code, and thus include the BSD license.

>
> >
> > > +    if (buffer->bits_left > 32)
> > > > +        return 0; // enough data, no need to pull in more bits
> > >
> > > Could this be >= 32?
> > >
> >
> > Any reason for that?
>
> Avoids reading more bits in some cases, potentially speeding up the
> decoder. Unless of course there are cases where 33 bits are absolutely
> necessary.
>
> >
> >
> > > > +    tmp = AV_RB32(&array[position + 1]);
> > >
> > > I presume array points such that reading negative positions is
> > > always
> > > OK, even if somehow the forward bitstream is very short
> > >
> > Yes ,  we can only read three bytes backwards, and we always ensure
> > we have
> > more than three bytes in the buffer,we check for length(Lcup) being
> > greater
> > than 2 in ff_jpeg2000_decode_htj2k
>
> Great
>
> > > > +/**
> > > > + * Look ahead bit buffer without discarding bits.
> > > > + */
> > > > +av_always_inline
> > > > +static uint64_t jpeg2000_bitbuf_peek_bits_lsb(StateVars *stream,
> > > > uint8_t nbits)
> > > > +{
> > > > +    uint64_t mask = (1ull << nbits) - 1;
> > >
> > > What if bits_left < nbits? Can it happen?
> > > Looks like callers ensure this, but checking it would be more in
> > > line
> > > with the other bit functions here
> > >
> > So should we remove checks from callers and place them inside the
> > function
> > or ?
>
> It would make the code smaller and prettier, and there's no repeated
> calls to jpeg2000_bitbuf_peek_bits_lsb() that would benefit from only
> checking the length outside the function. Were there a loop that needs
> to peek multiple times then it could make sense, but there are none.
>
> >
> >
> > > For forward reading I feel like we could reuse lavc's bitreader and
> > > just do unstuffing after reading. Or?
> > >
> > Plausible, but may be slower.
>
> Let's leave it for later then.
>
> /Tomas
>
> _______________________________________________
> 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".
_______________________________________________
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".

  reply	other threads:[~2023-04-11 17:58 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-31 15:29 [FFmpeg-devel] [PATCH v1 1/3] avcodec/jpeg2000dec: move decoder structs to a header file pal
2023-03-31 15:29 ` [FFmpeg-devel] [PATCH v1 2/3] avcodec/jpeg2000dec: add support for HTJ2K block decoding pal
2023-04-02 22:17   ` Michael Niedermayer
2023-04-02 22:21     ` Pierre-Anthony Lemieux
2023-04-03 14:27       ` Michael Niedermayer
2023-04-03 16:20         ` Caleb Etemesi
2023-04-04 14:54           ` Michael Niedermayer
2023-04-05 12:34   ` Tomas Härdin
2023-04-05 13:16     ` Caleb Etemesi
2023-04-05 13:45       ` Tomas Härdin
2023-04-11 17:57         ` Pierre-Anthony Lemieux [this message]
2023-03-31 15:29 ` [FFmpeg-devel] [PATCH v1 3/3] fate/jpeg2000: add JPEG 2000 tests using ITU/ISO conformance materials pal
2023-04-02 19:27   ` Michael Niedermayer
2023-04-02 19:31     ` Michael Niedermayer
2023-04-03  5:05       ` Pierre-Anthony Lemieux
2023-04-05  4:38       ` Pierre-Anthony Lemieux
2023-04-03 17:40     ` Pierre-Anthony Lemieux

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAF_7JxBdLxxs5v+QC5RysSUuxbDJXfbef1soJwiKwmfj_jbiow@mail.gmail.com \
    --to=pal@sandflow.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git