/*
- * DSP utils
- *
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "me_cmp.h"
-#include "dsputil.h"
+#ifndef AVUTIL_TIME_INTERNAL_H
+#define AVUTIL_TIME_INTERNAL_H
-#if FF_API_DSPUTIL
+#include <time.h>
+#include "config.h"
-void avpriv_dsputil_init(DSPContext* p, AVCodecContext *avctx)
+#if !HAVE_GMTIME_R && !defined(gmtime_r)
+static inline struct tm *gmtime_r(const time_t* clock, struct tm *result)
{
- MECmpContext mecc;
-
- ff_me_cmp_init(&mecc, avctx);
-#define COPY(name) memcpy(&p->name, &mecc.name, sizeof(p->name))
- COPY(sum_abs_dctelem);
- COPY(sad);
- COPY(sse);
- COPY(hadamard8_diff);
- COPY(dct_sad);
- COPY(quant_psnr);
- COPY(bit);
- COPY(rd);
- COPY(vsad);
- COPY(vsse);
- COPY(nsse);
- COPY(w53);
- COPY(w97);
- COPY(dct_max);
- COPY(dct264_sad);
- COPY(me_pre_cmp);
- COPY(me_cmp);
- COPY(me_sub_cmp);
- COPY(mb_cmp);
- COPY(ildct_cmp);
- COPY(frame_skip_cmp);
- COPY(pix_abs);
+ struct tm *ptr = gmtime(clock);
+ if (!ptr)
+ return NULL;
+ *result = *ptr;
+ return result;
}
+#endif
+#if !HAVE_LOCALTIME_R && !defined(localtime_r)
+static inline struct tm *localtime_r(const time_t* clock, struct tm *result)
+{
+ struct tm *ptr = localtime(clock);
+ if (!ptr)
+ return NULL;
+ *result = *ptr;
+ return result;
+}
#endif
+
+#endif /* AVUTIL_TIME_INTERNAL_H */