]> granicus.if.org Git - libvpx/blob - tools_common.h
Add vp9_tm_predictor_16x16 neon implementation
[libvpx] / tools_common.h
1 /*
2  *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 #ifndef TOOLS_COMMON_H_
11 #define TOOLS_COMMON_H_
12
13 #include <stdio.h>
14
15 #include "./vpx_config.h"
16 #include "vpx/vpx_image.h"
17 #include "vpx/vpx_integer.h"
18
19 #if CONFIG_ENCODERS
20 #include "./y4minput.h"
21 #endif
22
23 #if defined(_MSC_VER)
24 /* MSVS doesn't define off_t, and uses _f{seek,tell}i64. */
25 typedef __int64 off_t;
26 #define fseeko _fseeki64
27 #define ftello _ftelli64
28 #elif defined(_WIN32)
29 /* MinGW defines off_t as long and uses f{seek,tell}o64/off64_t for large
30  * files. */
31 #define fseeko fseeko64
32 #define ftello ftello64
33 #define off_t off64_t
34 #endif  /* _WIN32 */
35
36 #if CONFIG_OS_SUPPORT
37 #if defined(_MSC_VER)
38 #include <io.h>  /* NOLINT */
39 #define snprintf _snprintf
40 #define isatty   _isatty
41 #define fileno   _fileno
42 #else
43 #include <unistd.h>  /* NOLINT */
44 #endif  /* _MSC_VER */
45 #endif  /* CONFIG_OS_SUPPORT */
46
47 /* Use 32-bit file operations in WebM file format when building ARM
48  * executables (.axf) with RVCT. */
49 #if !CONFIG_OS_SUPPORT
50 typedef long off_t;  /* NOLINT */
51 #define fseeko fseek
52 #define ftello ftell
53 #endif  /* CONFIG_OS_SUPPORT */
54
55 #define LITERALU64(hi, lo) ((((uint64_t)hi) << 32) | lo)
56
57 #ifndef PATH_MAX
58 #define PATH_MAX 512
59 #endif
60
61 #define IVF_FRAME_HDR_SZ (4 + 8)  /* 4 byte size + 8 byte timestamp */
62 #define IVF_FILE_HDR_SZ 32
63
64 #define RAW_FRAME_HDR_SZ sizeof(uint32_t)
65
66 #define VP8_FOURCC 0x30385056
67 #define VP9_FOURCC 0x30395056
68
69 enum VideoFileType {
70   FILE_TYPE_RAW,
71   FILE_TYPE_IVF,
72   FILE_TYPE_Y4M,
73   FILE_TYPE_WEBM
74 };
75
76 struct FileTypeDetectionBuffer {
77   char buf[4];
78   size_t buf_read;
79   size_t position;
80 };
81
82 struct VpxRational {
83   int numerator;
84   int denominator;
85 };
86
87 struct VpxInputContext {
88   const char *filename;
89   FILE *file;
90   off_t length;
91   struct FileTypeDetectionBuffer detect;
92   enum VideoFileType file_type;
93   uint32_t width;
94   uint32_t height;
95   int use_i420;
96   int only_i420;
97   uint32_t fourcc;
98   struct VpxRational framerate;
99 #if CONFIG_ENCODERS
100   y4m_input y4m;
101 #endif
102 };
103
104 #ifdef __cplusplus
105 extern "C" {
106 #endif
107
108 /* Sets a stdio stream into binary mode */
109 FILE *set_binary_mode(FILE *stream);
110
111 void die(const char *fmt, ...);
112 void fatal(const char *fmt, ...);
113 void warn(const char *fmt, ...);
114
115 /* The tool including this file must define usage_exit() */
116 void usage_exit();
117
118 uint16_t mem_get_le16(const void *data);
119 uint32_t mem_get_le32(const void *data);
120
121 int read_yuv_frame(struct VpxInputContext *input_ctx, vpx_image_t *yuv_frame);
122
123 #ifdef __cplusplus
124 }  /* extern "C" */
125 #endif
126
127 #endif  // TOOLS_COMMON_H_