[FFmpeg-devel] [PATCH] avio: add avio_skip function

Ronald S. Bultje rsbultje
Fri Mar 4 12:48:23 CET 2011


Hi,

2011/3/4 M?ns Rullg?rd <mans at mansr.com>:
> "Ronald S. Bultje" <rsbultje at gmail.com> writes:
>
>> Hi,
>>
>> On Fri, Mar 4, 2011 at 5:41 AM, Peter Ross <pross at xvid.org> wrote:
>>> This is a substitute for the url_fskip function that was deprecated by
>>> commit 0300db8ad778a194b4a8ec98f6da3de5b41c46ee. avio_fskip is provided to
>>> improve demuxer code readability. It distinguishes the act of skipping over
>>> unknown or irrelevant bytes from the standard avio_seek operation.
>>> ---
>>>
>>> On Thu, Mar 03, 2011 at 03:16:19PM +0100, Michael Niedermayer wrote:
>>>> On Thu, Mar 03, 2011 at 08:26:50AM -0500, Ronald S. Bultje wrote:
>>>> > Hi,
>>>> >
>>>> > On Thu, Mar 3, 2011 at 6:37 AM, Peter Ross <pross at xvid.org> wrote:
>>>> > > This is a substitute for the url_fskip function that was deprecated by
>>> [..]
>>>> for the record id like to repeat that a function is better for this
>>>
>>> I am happy either way.
>>> Here is an patch with avio_skip as a function.
>>
>> Sorry for responding slowly. I am fine with it as a macro. I think
>> Mans preferred the macro as well. The theoretical advantages of the
>> skip-as-a-function approach don't exist because gcc doesn't inline the
>> function.
>
> How could it, it'd be part of the library ABI.

Function == url_fseek in this context, sorry for confusing.

If url_fskip() inlined url_fseek(), there'd be a theoretical advantage
of having a function that only takes two arguments and thus takes less
registers.

Since it doesn't inline url_fseek(), it does take three arguments up
during runtime regardless of how it's called, and thus the macro
serves the same approach as a function.

If url_fskip inlined (i.e. duplicated) url_fseek, then it'd be a
special case for whence==SEEK_CUR, thus saving one function argument
and either a register or a few bytes on the stack. Not much, but it's
something to at least consider.

Since that's not the case, we can ignore this advantage and
automatically the macro approach is better.

Ronald



More information about the ffmpeg-devel mailing list