On Fri, 15 Nov 2013, Anton Khirnov wrote:

They are used when decoding the frame header.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:[email protected]
---
libavcodec/mpeg4video.h        |    2 ++
libavcodec/mpeg4video_parser.c |    2 ++
libavcodec/mpeg4videodec.c     |    4 ++--
3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavcodec/mpeg4video.h b/libavcodec/mpeg4video.h
index c22fbfd..d7157d3 100644
--- a/libavcodec/mpeg4video.h
+++ b/libavcodec/mpeg4video.h
@@ -112,6 +112,8 @@ void ff_mpeg4_init_direct_mv(MpegEncContext *s);
 */
int ff_mpeg4_set_direct_mv(MpegEncContext *s, int mx, int my);

+void ff_mpeg4_init_tables(void);
+
extern uint8_t ff_mpeg4_static_rl_table_store[3][2][2 * MAX_RUN + MAX_LEVEL + 
3];

#if 0 //3IV1 is quite rare and it slows things down a tiny bit
diff --git a/libavcodec/mpeg4video_parser.c b/libavcodec/mpeg4video_parser.c
index a8def0e..dfddeda 100644
--- a/libavcodec/mpeg4video_parser.c
+++ b/libavcodec/mpeg4video_parser.c
@@ -105,6 +105,8 @@ static av_cold int 
mpeg4video_parse_init(AVCodecParserContext *s)
{
    struct Mp4vParseContext *pc = s->priv_data;

+    ff_mpeg4_init_tables();
+

Contrary to the normal codec init function, this can get called from any thread outside of the normal avcodec init lock. OTOH, if the static init code is safe to be run in parallel from multiple threads I guess it isn't an issue, but it's worth noting.

// Martin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to