[FFmpeg-devel] H264 cleanup performance effects

Michael Niedermayer michaelni at gmx.at
Sun Mar 22 15:12:04 CET 2015


Hi anton, everyone else

the "cosmetic" commits from yesterday
(665e0c10a63d31dd6c7b1fba14db074625d54614..fa7c08d5e192aea77fdfb7f52c44c196a3ba4452) /
(d8a45d2d49f54fde042b195f9d5859251252493d..c28ed1d743443e783537d279ae721be3bbdf7646)

cause a ~1% speed loss in the H.264 decoder which is probably the
most important decoder in the codebase

after the patchset:
-threads 1 -benchmark -i cathedral-beta2-400extra-crop-avc.mp4 -an -f null -
utime=5.448s
utime=5.424s
utime=5.436s
utime=5.428s
utime=5.448s


before the patchset:
-threads 1 -benchmark -i cathedral-beta2-400extra-crop-avc.mp4 -an -f null -
utime=5.360s
utime=5.328s
utime=5.356s
utime=5.376s
utime=5.360s

Testing has been done with a single thread as the results with
multiple threads where inconsistent/unstable

The speedloss is reproduceable with ffmpeg as well as libav

also in some of the commits there where hidden optimizations:
for example in a12d3188cbec15e22070e139fa5cc541da07e2c3 there was:

-    for (list = 0; list < 2; list++) {
+    for (list = 0; list < sl->list_count; list++) {

@@ -130,16 +130,20 @@ void ff_h264_direct_ref_list_init(const H264Context *const h, H264SliceContext *
     cur->mbaff = FRAME_MBAFF(h);

     sl->col_fieldoff = 0;
+
+    if (sl->list_count != 2 || !sl->ref_count[1])
+        return;
+

@@ -340,20 +340,24 @@ int ff_h264_decode_ref_pic_list_reordering(H264Context *h, H264SliceContext *sl)
 void ff_h264_fill_mbaff_ref_list(H264Context *h, H264SliceContext *sl)
 {
     int list, i, j;
-    for (list = 0; list < 2; list++) { //FIXME try list_count
+    for (list = 0; list < sl->list_count; list++) { //FIXME try list_count


-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 3
"Rare item" - "Common item with rare defect or maybe just a lie"
"Professional" - "'Toy' made in china, not functional except as doorstop"
"Experts will know" - "The seller hopes you are not an expert"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150322/2706efb3/attachment.asc>


More information about the ffmpeg-devel mailing list