]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/dsd.c
avformat/dump: Remove remnants of codec timebase
[ffmpeg] / libavcodec / dsd.c
index 8a1fc21b0dfe7d6d5334f9107314fda5cbf482f6..95aab61ea482b633a271d036a16b25c5c0c6a694 100644 (file)
@@ -21,6 +21,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "libavutil/thread.h"
 #include "libavcodec/internal.h"
 #include "libavcodec/mathops.h"
 #include "avcodec.h"
@@ -45,20 +46,17 @@ static av_cold void dsd_ctables_tableinit(void)
 
 av_cold void ff_init_dsd_data(void)
 {
-    static int done = 0;
-    if (done)
-        return;
-    dsd_ctables_tableinit();
-    done = 1;
+    static AVOnce init_static_once = AV_ONCE_INIT;
+    ff_thread_once(&init_static_once, dsd_ctables_tableinit);
 }
 
 void ff_dsd2pcm_translate(DSDContext* s, size_t samples, int lsbf,
-                          const unsigned char *src, ptrdiff_t src_stride,
+                          const uint8_t *src, ptrdiff_t src_stride,
                           float *dst, ptrdiff_t dst_stride)
 {
-    unsigned char buf[FIFOSIZE];
+    uint8_t buf[FIFOSIZE];
     unsigned pos, i;
-    unsigned char* p;
+    uint8_t* p;
     double sum;
 
     pos = s->pos;
@@ -74,8 +72,8 @@ void ff_dsd2pcm_translate(DSDContext* s, size_t samples, int lsbf,
 
         sum = 0.0;
         for (i = 0; i < CTABLES; i++) {
-            unsigned char a = buf[(pos                   - i) & FIFOMASK];
-            unsigned char b = buf[(pos - (CTABLES*2 - 1) + i) & FIFOMASK];
+            uint8_t a = buf[(pos                   - i) & FIFOMASK];
+            uint8_t b = buf[(pos - (CTABLES*2 - 1) + i) & FIFOMASK];
             sum += ctables[i][a] + ctables[i][b];
         }