Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Paul B Mahol <onemda@gmail.com>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH] avcodec/vlc: auto calculate depth
Date: Wed, 28 Jun 2023 08:43:56 +0200
Message-ID: <CAPYw7P75B-9+q+CTTmpVnL5Y-CTmMJpz3Nx4U+r029kTVLiuTg@mail.gmail.com> (raw)
In-Reply-To: <AS8P250MB074478F6EEA42BEE694B91C18F27A@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM>

On Wed, Jun 28, 2023 at 12:26 AM Andreas Rheinhardt <
andreas.rheinhardt@outlook.com> wrote:

> Paul B Mahol:
> > On Tue, Jun 27, 2023 at 11:45 PM Andreas Rheinhardt <
> > andreas.rheinhardt@outlook.com> wrote:
> >
> >> Paul B Mahol:
> >>> On Tue, Jun 27, 2023 at 11:05 PM Andreas Rheinhardt <
> >>> andreas.rheinhardt@outlook.com> wrote:
> >>>
> >>>> Paul B Mahol:
> >>>>> On Tue, Jun 27, 2023 at 9:47 PM Andreas Rheinhardt <
> >>>>> andreas.rheinhardt@outlook.com> wrote:
> >>>>>
> >>>>>> Paul B Mahol:
> >>>>>>> Patch attached.
> >>>>>>>
> >>>>>>
> >>>>>> Where do you intend to use this? What is the point of it?
> >>>>>> After all, using this value in GET_VLC makes no sense; only
> >> compile-time
> >>>>>> constants do.
> >>>>>>
> >>>>>
> >>>>> It works when used in ac-4 as get_vlc2.
> >>>>>
> >>>>
> >>>> Could you please define "works"? Using a non-compile-time constant
> will
> >>>> not benefit at all; it will only lead to more runtime checks.
> >>>>
> >>>
> >>> I do not follow your worries.
> >>> I can not use compile time constant as its very complicated code.
> >>>
> >>
> >> Let's take a look at GET_VLC:
> >> #define GET_VLC(code, name, gb, table, bits, max_depth)         \
> >>     do {                                                        \
> >>         int n, nb_bits;                                         \
> >>         unsigned int index;                                     \
> >>                                                                 \
> >>         index = SHOW_UBITS(name, gb, bits);                     \
> >>         code  = table[index].sym;                               \
> >>         n     = table[index].len;                               \
> >>                                                                 \
> >>         if (max_depth > 1 && n < 0) {                           \
> >>             LAST_SKIP_BITS(name, gb, bits);                     \
> >>             UPDATE_CACHE(name, gb);                             \
> >>                                                                 \
> >>             nb_bits = -n;                                       \
> >>                                                                 \
> >>             index = SHOW_UBITS(name, gb, nb_bits) + code;       \
> >>             code  = table[index].sym;                           \
> >>             n     = table[index].len;                           \
> >>             if (max_depth > 2 && n < 0) {                       \
> >>                 LAST_SKIP_BITS(name, gb, nb_bits);              \
> >>                 UPDATE_CACHE(name, gb);                         \
> >>                                                                 \
> >>                 nb_bits = -n;                                   \
> >>                                                                 \
> >>                 index = SHOW_UBITS(name, gb, nb_bits) + code;   \
> >>                 code  = table[index].sym;                       \
> >>                 n     = table[index].len;                       \
> >>             }                                                   \
> >>         }                                                       \
> >>         SKIP_BITS(name, gb, n);                                 \
> >>     } while (0)
> >>
> >> If max_depth is not a compile-time constant, then the compiler will have
> >> to perform both of the max_depth > 1 && n < 0 checks; yet, this is not
> >> useful: If the depth of a particular VLC is (say) 1, then none of the
> >> possible bits read will lead to reloading at all, because the n < 0
> >> condition will never be true; the only reason this condition exists is
> >> to use a compile-time upper bound, so that one can eliminate the reload
> >> code (and in particular, avoid the runtime checks).
> >>
> >>> Works means that vlc code is extracted correctly.
> >>>
> >>
> >> If you have no upper bound about max_depth and it works, then use 3.
> >>
> >
> > It does not work to use 3 all the time. And that one never worked in any
> > codec so far.
> >
>
> I just ran FATE with the check for max_depth removed from GET_VLC and
> from read_vlc for the cached API (effectively setting max_depth to 3
> everywhere). It passed. So it "works" (but in a suboptimal way). At
> least it does if you have ordinary VLCs (created by the vlc.c
> functions). Are you doing anything special with them or so?
>

FATE code coverage is very limited.

Also I do not follow your reasoning about this added field at all.

What is calculated over and over again in each get_vlc2() call?


>
> - Andreas
>
> _______________________________________________
> 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-06-28  6:44 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-26 21:57 Paul B Mahol
2023-06-27 19:48 ` Andreas Rheinhardt
2023-06-27 20:35   ` Paul B Mahol
2023-06-27 20:50     ` Andreas Rheinhardt
2023-06-27 21:27       ` Paul B Mahol
2023-06-27 21:46         ` Andreas Rheinhardt
2023-06-27 22:00           ` Paul B Mahol
2023-06-27 22:27             ` Andreas Rheinhardt
2023-06-28  6:43               ` Paul B Mahol [this message]
2023-06-28  9:12                 ` Andreas Rheinhardt
2023-06-28  9:57                   ` Paul B Mahol
2023-06-28 15:16                     ` Paul B Mahol
2023-06-28 17:35                       ` Andreas Rheinhardt
2023-06-29 18:56                         ` Paul B Mahol
2023-06-29 19:06                           ` Andreas Rheinhardt
2023-06-30 11:37                             ` Paul B Mahol
2023-06-30 12:36                               ` Andreas Rheinhardt
2023-06-30 17:41                                 ` Paul B Mahol
2023-07-02  9:16                                   ` Paul B Mahol
2023-07-02 23:57                                     ` Andreas Rheinhardt
2023-07-03 11:22                                       ` Paul B Mahol
2023-06-28 16:27                     ` Andreas Rheinhardt

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=CAPYw7P75B-9+q+CTTmpVnL5Y-CTmMJpz3Nx4U+r029kTVLiuTg@mail.gmail.com \
    --to=onemda@gmail.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