diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-12-06 15:24:10 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-12-06 15:27:36 +0100 |
commit | 133fbfc7811ffae7b97dd129fcd0b5e646742362 (patch) | |
tree | 9114fed08d3d1b9b801e702b25a40a1e1df47c8b /libavformat/format.c | |
parent | 2b215f39391c0f9ddb547d16d568776e9e5da54d (diff) | |
download | ffmpeg-133fbfc7811ffae7b97dd129fcd0b5e646742362.tar.gz |
do O(1) instead of O(n) atomic operations in register functions
about 1ms faster startup time
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/format.c')
-rw-r--r-- | libavformat/format.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libavformat/format.c b/libavformat/format.c index ac9100b604..36c0131c12 100644 --- a/libavformat/format.c +++ b/libavformat/format.c @@ -54,7 +54,7 @@ void av_register_input_format(AVInputFormat *format) AVInputFormat **p = &first_iformat; format->next = NULL; - while(avpriv_atomic_ptr_cas((void * volatile *)p, NULL, format)) + while(*p || avpriv_atomic_ptr_cas((void * volatile *)p, NULL, format)) p = &(*p)->next; } @@ -63,7 +63,7 @@ void av_register_output_format(AVOutputFormat *format) AVOutputFormat **p = &first_oformat; format->next = NULL; - while(avpriv_atomic_ptr_cas((void * volatile *)p, NULL, format)) + while(*p || avpriv_atomic_ptr_cas((void * volatile *)p, NULL, format)) p = &(*p)->next; } |