From: Leo Izen <leo.izen@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH 5/9] avcodec/vlc: Pass VLC_MULTI_ELEM directly not by pointer
Date: Tue, 24 Oct 2023 05:54:37 -0400
Message-ID: <abe7cf82-0991-4c5c-a6fd-1beb56505ba9@gmail.com> (raw)
In-Reply-To: <20231023160416.GY3543730@pb2>
On 10/23/23 12:04, Michael Niedermayer wrote:
> On Mon, Oct 23, 2023 at 02:10:35AM -0400, Leo Izen wrote:
>> On 10/22/23 17:51, Michael Niedermayer wrote:
>>> This makes the code more testable as uninitialized fields are 0
>>> and not random values from the last call
>>>
>>> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
>>> ---
>>>    libavcodec/vlc.c | 14 +++++++-------
>>>    1 file changed, 7 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/libavcodec/vlc.c b/libavcodec/vlc.c
>>> index 9b7a42f79a3..4adec2da705 100644
>>> --- a/libavcodec/vlc.c
>>> +++ b/libavcodec/vlc.c
>>> @@ -356,7 +356,7 @@ static void add_level(VLC_MULTI_ELEM *table, const int is16bit,
>>>                          uint32_t curcode, int curlen,
>>>                          int curlimit, int curlevel,
>>>                          const int minlen, const int max,
>>> -                      unsigned* levelcnt, VLC_MULTI_ELEM *info)
>>> +                      unsigned* levelcnt, VLC_MULTI_ELEM info)
>>
>>
>> Is passing a struct by value advisable? Did you benchmark this? How does it
>> compare to memset(info, 0, sizeof(*info))?
> 
> The struct is 8 bytes, a pointer on 64bit arch is also 8byte
> 
> I did not benchmark, I think this code doesnt run that many iterations
> (when its not buggy), I mean each iteration adds a entry to the table
> and the table will normally be designed to fit in cache and its only
> for initializing.
> 
> do you still want me to bechmark this ?
> 
> thx
> 
If the struct is only 8 bytes it's probably not necessary.
- Leo Izen (Traneptora)
_______________________________________________
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".
next prev parent reply	other threads:[~2023-10-24  9:54 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-22 21:51 [FFmpeg-devel] [PATCH 1/9] avcodec/vlc: merge lost 16bit end of array check Michael Niedermayer
2023-10-22 21:51 ` [FFmpeg-devel] [PATCH 2/9] avcodec/vlc: dont pass nb_elems into multi vlc code Michael Niedermayer
2023-10-22 21:51 ` [FFmpeg-devel] [PATCH 3/9] avcodec/vlc: Skip subtable entries in multi VLC Michael Niedermayer
2023-10-22 21:51 ` [FFmpeg-devel] [PATCH 4/9] avcodec/vlc: Replace mysterious max computation code in multi vlc Michael Niedermayer
2023-10-22 21:51 ` [FFmpeg-devel] [PATCH 5/9] avcodec/vlc: Pass VLC_MULTI_ELEM directly not by pointer Michael Niedermayer
2023-10-23  6:10   ` Leo Izen
2023-10-23 16:04     ` Michael Niedermayer
2023-10-24  9:54       ` Leo Izen [this message]
2023-10-31 22:22         ` Michael Niedermayer
2023-10-22 21:51 ` [FFmpeg-devel] [PATCH 6/9] avcodec/vlc: Remove mysterious jitter loop in multi VLC Michael Niedermayer
2023-10-22 21:51 ` [FFmpeg-devel] [PATCH 7/9] Revert "avcodec/vlc: add correct upper limit for recursive function" Michael Niedermayer
2023-10-22 21:51 ` [FFmpeg-devel] [PATCH 8/9] Revert "avcodec/vlc: fix off by one in limit check for multi" Michael Niedermayer
2023-10-22 21:51 ` [FFmpeg-devel] [PATCH 9/9] avcodec/vlc: simplify min/maxbits in multi VLC Michael Niedermayer
2023-10-22 23:02 ` [FFmpeg-devel] [PATCH 1/9] avcodec/vlc: merge lost 16bit end of array check Paul B Mahol
2023-10-23 16:05   ` Michael Niedermayer
2023-10-26 22:35 ` Michael Niedermayer
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=abe7cf82-0991-4c5c-a6fd-1beb56505ba9@gmail.com \
    --to=leo.izen@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