New issue
Advanced search Search tips

Issue 880566 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner:
Closed: Sep 18
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Task



Sign in to add a comment

FFmpeg's cavlc tables are unnecessarily compile time allocated.

Project Member Reported by dalecur...@chromium.org, Sep 4

Issue description

https://cs.chromium.org/chromium/src/third_party/ffmpeg/libavcodec/h264_cavlc.c?l=238

These tables need not be static arrays, but instead could just be pointers that are allocated during the ff_h264_decode_init_vlc() function, per the android binary size bot these represent 75713 bytes of zeros:
+ 0)          0 (0.0%)  b@0x2f4e5b4  32768 (0->32768)   {{no path}}                chroma422_dc_coeff_token_vlc_table
+ 1)          0 (0.0%)  b@0x2f58054  30720 (0->30720)   {{no path}}                total_zeros_vlc_tables
+ 11)     72416 (18.8%) b@0x2f565c4  5552 (0->5552)     {{no path}}                coeff_token_vlc_tables
+ 18)     99692 (25.9%) b@0x2f5fc14  3584 (0->3584)     {{no path}}                cavlc_level_tab
+ 55)    161188 (41.9%) b@0x2f4e1a2  1025 (0->1024)     {{no path}}                chroma_dc_coeff_token_vlc_table
+ 71)    175772 (45.7%) b@0x2f57c54  896 (0->896)       {{no path}}                chroma422_dc_total_zeros_vlc_tables
+ 185)   235598 (61.3%) b@0x2f5fa84  384 (0->384)       {{no path}}                run7_vlc_table
+ 279)   265006 (68.9%) b@0x2f5f854  256 (0->256)       {{no path}}                total_zeros_vlc
+ 376)   285832 (74.3%) b@0x2f5f954  192 (0->192)       {{no path}}                run_vlc_tables
+ 775)   341145 (88.7%) b@0x2f5fa14  112 (0->112)       {{no path}}                run_vlc
+ 895)   353240 (91.8%) b@0x2f57bb4  96 (0->96)         {{no path}}                chroma_dc_total_zeros_vlc_tables
+ 1096)   369285 (96.0%) b@0x2f57c14  64 (0->64)         {{no path}}                chroma_dc_total_zeros_vlc
+ 1097)   369285 (96.0%) b@0x2f57b74  64 (0->64)         {{no path}}                coeff_token_vlc
https://chromium-review.googlesource.com/c/chromium/src/+/1199625

Trivially replacing these with av_mallocz() crashes in media_unittest, so the type data is being confused somehow:
https://chromium-review.googlesource.com/c/chromium/third_party/ffmpeg/+/1205412


 
These don't end up stored as zeros on disk, just created in memory at library load. Still a bit unnecessary though so will fix.
Patch sent upstream.
Status: WontFix (was: Assigned)
WontFix these actually aren't allocated until the memory is used, so this is fine.

Sign in to add a comment