[FFmpeg-devel] [PATCH 2/2] MxPEG decoder

Anatoly Nenashev anatoly.nenashev
Thu Nov 11 00:16:27 CET 2010


On 10.11.2010 18:28, Michael Niedermayer wrote:
> On Wed, Nov 10, 2010 at 06:08:47PM +0300, Anatoly Nenashev wrote:
>    
>> [...]
>> If to read more than 16 byte at once then it is required additional
>> operations of memcpy and memmove.
>> For example. If I read buffer of 256 bytes in which audio packet
>> available in position 10 and size 100 then I need
>> to copy data of size 100-10=90 in new audio packet and move data of size
>> 256-100=156 in internal buffer. I think this may reduce the performance.
>>      
> you dont need to move it.
>
> and the overhead of all your code executed once every 16 bytes will reduce
> performance more than an occasional memcpy(). That said it can be done
> without memcpy by accessing the internal buffer but iam not suggesting this
> to be done.
>    

Does it means that packet is accessible only between two calls of 
av_read_packet or, in other words, that demuxer is the only one who owns 
the output packets?
In this case I see the solution which has no problems with additional 
copying of memory, but if someone wants to hold a packet much longer 
then it should make a copy.
Before I thought that the packet is accessible until somebody won't call 
on it av_free_packet.



More information about the ffmpeg-devel mailing list