[FFmpeg-devel] [RFC] use ff_avc_find_startcode in ff_find_start_code
Michael Niedermayer
michaelni
Tue Feb 19 15:06:15 CET 2008
On Tue, Feb 19, 2008 at 10:05:03AM +0100, Reimar D?ffinger wrote:
> Hello,
> On Tue, Feb 19, 2008 at 03:57:07AM +0100, Michael Niedermayer wrote:
> > current code:
> > 7054 dezicycles in findsc, 262131 runs, 13 skips
> > 7082 dezicycles in findsc, 262134 runs, 10 skips
> >
> > your code:
> > 11371 dezicycles in findsc, 262119 runs, 25 skips
> > 11624 dezicycles in findsc, 262115 runs, 29 skips
> >
> > gcc: 4.3.0 20080127 (experimental)
> > 800mhz duron
> > ffmpeg -v 9 -i matrixbench_mpeg2.mpg -vcodec copy -an -y test.avi
>
> Hmm... but like this it is only used in the demuxer code, right?
Its only used in the AVParser in the above. The decoder IIRC does only search
like 3 bytes or so unless you use multithreaded decoding. So if you didnt
use lavf for demuxing then i dont understand how you could see any difference
at all.
> How/where did you place the START_TIMER/STOP_TIMER?
-------
Index: libavcodec/mpegvideo.c
===================================================================
--- libavcodec/mpegvideo.c (revision 11927)
+++ libavcodec/mpegvideo.c (working copy)
@@ -97,6 +97,8 @@
}
}
+uint8_t *ff_avc_find_startcode(uint8_t *p, uint8_t *end);
+
const uint8_t *ff_find_start_code(const uint8_t * restrict p, const uint8_t *end, uint32_t * restrict state){
int i;
@@ -110,7 +112,12 @@
if(tmp == 0x100 || p==end)
return p;
}
-
+{
+START_TIMER
+#if 1
+ p = ff_avc_find_startcode(p-3, end);
+ p = FFMIN(p + 4, end);
+#else
while(p<end){
if (p[-1] > 1 ) p+= 3;
else if(p[-2] ) p+= 2;
@@ -120,6 +127,9 @@
break;
}
}
+#endif
+STOP_TIMER("findsc")
+}
p= FFMIN(p, end)-4;
*state= AV_RB32(p);
---------
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Those who are too smart to engage in politics are punished by being
governed by those who are dumber. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080219/7eefc478/attachment.pgp>
More information about the ffmpeg-devel
mailing list