[FFmpeg-devel] rough PATCH: reducing the memory copies

mmh mmh
Tue Jun 26 03:40:26 CEST 2007


Michael Niedermayer writes:
 > Hi
 > 
 > On Mon, Jun 25, 2007 at 08:01:15PM -0400, mmh wrote:
 > Content-Description: message body text
 > > 
 > > This saves me about 50MIPS + reduce cache stress, by elliminating this
 > > memory copy, which I guess happens later anyways again.
 > > 
 > > I know that I need to creat a new function in utils.c for this like
 > > av_new_packet probably av_ref_packet which does the work in the if variant.
 > > 
 > > What are the problems with this and, other ideas that comes to mind?
 > 
 > there probably wont be any problems, it should work fine though
 > as you suspected it will sometimes tough not always cause a memcpy()
 > to be done later ...
 > 
 > 
 > [...]
 > > -
 > > +    PROF_BEGIN();
 > 
 > this doesnt belong in here, the code is messy enough as is
 > 
 > 
 > >      ptr = s->video_buf + s->gb_buffers.offsets[s->gb_frame];
 > > -    memcpy(buf, ptr, s->frame_size);
 > >  
 > > +    if (s->gb_buffers.frames > 1) {
 > > +        av_free (pkt->data);
 > 
 > alloc+free is not ok, dont malloc()
 > 
 > 
 > > +        pkt->destruct= av_destruct_packet_nofree;
 > > +        pkt->data = ptr;
 > > +	pkt->size = s->frame_size;
 > 
 > tab
 > 
 > 

Trivial prototype correction.. Sorry for the confusion.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: g0.patch
Type: text/x-patch
Size: 3230 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070625/81d3f85a/attachment.bin>



More information about the ffmpeg-devel mailing list