Narendrabrsoft / libyuv

Automatically exported from code.google.com/p/libyuv
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

ValidateJPeg is slow when a very large size is passed #404

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
For a small jpeg where the wrong size field is passed in, the function can be 
slow.

Original issue reported on code.google.com by fbarch...@google.com on 17 Feb 2015 at 6:24

GoogleCodeExporter commented 8 years ago

Original comment by fbarch...@google.com on 17 Feb 2015 at 7:11

GoogleCodeExporter commented 8 years ago
wrote test in r1284
set LIBYUV_WIDTH=640
set LIBYUV_HEIGHT=360
set LIBYUV_REPEAT=40000

[       OK ] libyuvTest.ValidateJpegLarge (36890 ms)
[       OK ] libyuvTest.InvalidateJpeg (4063 ms)
[       OK ] libyuvTest.ValidateJpeg (0 ms)

With scan from start of buffer:
out\release\libyuv_unittest --gtest_catch_exceptions=0 --gtest_filter=*Jpeg*  | 
sortms
[       OK ] libyuvTest.ValidateJpegLarge (2210 ms)
[       OK ] libyuvTest.InvalidateJpeg (2020 ms)
[       OK ] libyuvTest.ValidateJpeg (1 ms)

Original comment by fbarch...@google.com on 17 Feb 2015 at 7:41

GoogleCodeExporter commented 8 years ago
Fixed in r1285
ValidateJpegLarge (2160 ms)
InvalidateJpeg (1985 ms)
ValidateJpeg (18 ms)

To speed it up further, consider a proper marker parser which would understand 
the size of each field.  Some markers have size fields.  Some are fixed size.  
It could step thru the jpeg faster if it knew the format.

Original comment by fbarch...@google.com on 18 Feb 2015 at 2:01