History

spelling/grammar/consistency review part I

Originally committed as revision 16840 to svn://svn.ffmpeg.org/ffmpeg/trunk

Diego Biurrun committed 17 years ago

Commit 89c9ff51 parent d972e5627 files · +175 −178Browse files

Unified · Split

27 files
  1. libavutil/avstring.h +2 −2
  2. libavutil/avutil.h +38 −38
  3. libavutil/bswap.h +2 −2
  4. libavutil/common.h +12 −12
  5. libavutil/crc.c +3 −3
  6. libavutil/crc.h +1 −1
  7. libavutil/fifo.c +2 −2
  8. libavutil/fifo.h +7 −7
  9. libavutil/integer.c +1 −1
  10. libavutil/integer.h +8 −7
  11. libavutil/internal.h +1 −1
  12. libavutil/intfloat_readwrite.c +2 −2
  13. libavutil/lfg.h +3 −3
  14. libavutil/lzo.c +10 −10
  15. libavutil/mathematics.c +1 −1
  16. libavutil/mathematics.h +10 −10
  17. libavutil/md5.c +8 −8
  18. libavutil/mem.c +8 −8
  19. libavutil/mem.h +18 −19
  20. libavutil/pca.c +3 −3
  21. libavutil/pca.h +2 −2
  22. libavutil/random.c +3 −3
  23. libavutil/rational.c +2 −2
  24. libavutil/rational.h +20 −20
  25. libavutil/sha1.c +1 −1
  26. libavutil/softfloat.h +6 −9
  27. libavutil/tree.c +1 −1
libavutil/avstring.h+2−2
@@ -48,7 +48,7 @@ int av_stristart(const char *str, const char *pfx, const char **ptr); · 47 unmodified lines
48 48
49/**49/**
50 * Copy the string src to dst, but no more than size - 1 bytes, and50 * Copy the string src to dst, but no more than size - 1 bytes, and
51 * null terminate dst.51 * null-terminate dst.
52 *52 *
53 * This function is the same as BSD strlcpy().53 * This function is the same as BSD strlcpy().
54 *54 *
@@ -61,7 +61,7 @@ size_t av_strlcpy(char *dst, const char *src, size_t size); · 6 unmodified lines
61 61
62/**62/**
63 * Append the string src to the string dst, but to a total length of63 * Append the string src to the string dst, but to a total length of
64 * no more than size - 1 bytes, and null terminate dst.64 * no more than size - 1 bytes, and null-terminate dst.
65 *65 *
66 * This function is similar to BSD strlcat(), but differs when66 * This function is similar to BSD strlcat(), but differs when
67 * size <= strlen(dst).67 * size <= strlen(dst).
libavutil/avutil.h+38−38
@@ -62,11 +62,11 @@ unsigned avutil_version(void); · 61 unmodified lines
62/**62/**
63 * Pixel format. Notes:63 * Pixel format. Notes:
64 *64 *
65 * PIX_FMT_RGB32 is handled in an endian-specific manner. A RGBA65 * PIX_FMT_RGB32 is handled in an endian-specific manner. An RGBA
66 * color is put together as:66 * color is put together as:
67 * (A << 24) | (R << 16) | (G << 8) | B67 * (A << 24) | (R << 16) | (G << 8) | B
68 * This is stored as BGRA on little endian CPU architectures and ARGB on68 * This is stored as BGRA on little-endian CPU architectures and ARGB on
69 * big endian CPUs.69 * big-endian CPUs.
70 *70 *
71 * When the pixel format is palettized RGB (PIX_FMT_PAL8), the palettized71 * When the pixel format is palettized RGB (PIX_FMT_PAL8), the palettized
72 * image data is stored in AVFrame.data[0]. The palette is transported in72 * image data is stored in AVFrame.data[0]. The palette is transported in
@@ -79,53 +79,53 @@ unsigned avutil_version(void); · 6 unmodified lines
79 */79 */
80enum PixelFormat {80enum PixelFormat {
81 PIX_FMT_NONE= -1,81 PIX_FMT_NONE= -1,
82 PIX_FMT_YUV420P, ///< Planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)82 PIX_FMT_YUV420P, ///< planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
83 PIX_FMT_YUYV422, ///< Packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr83 PIX_FMT_YUYV422, ///< packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
84 PIX_FMT_RGB24, ///< Packed RGB 8:8:8, 24bpp, RGBRGB...84 PIX_FMT_RGB24, ///< packed RGB 8:8:8, 24bpp, RGBRGB...
85 PIX_FMT_BGR24, ///< Packed RGB 8:8:8, 24bpp, BGRBGR...85 PIX_FMT_BGR24, ///< packed RGB 8:8:8, 24bpp, BGRBGR...
86 PIX_FMT_YUV422P, ///< Planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)86 PIX_FMT_YUV422P, ///< planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
87 PIX_FMT_YUV444P, ///< Planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)87 PIX_FMT_YUV444P, ///< planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
88 PIX_FMT_RGB32, ///< Packed RGB 8:8:8, 32bpp, (msb)8A 8R 8G 8B(lsb), in cpu endianness88 PIX_FMT_RGB32, ///< packed RGB 8:8:8, 32bpp, (msb)8A 8R 8G 8B(lsb), in CPU endianness
89 PIX_FMT_YUV410P, ///< Planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)89 PIX_FMT_YUV410P, ///< planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
90 PIX_FMT_YUV411P, ///< Planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)90 PIX_FMT_YUV411P, ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
91 PIX_FMT_RGB565, ///< Packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), in cpu endianness91 PIX_FMT_RGB565, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), in CPU endianness
92 PIX_FMT_RGB555, ///< Packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), in cpu endianness most significant bit to 092 PIX_FMT_RGB555, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), in CPU endianness, most significant bit to 0
93 PIX_FMT_GRAY8, ///< Y , 8bpp93 PIX_FMT_GRAY8, ///< Y , 8bpp
94 PIX_FMT_MONOWHITE, ///< Y , 1bpp, 0 is white, 1 is black94 PIX_FMT_MONOWHITE, ///< Y , 1bpp, 0 is white, 1 is black
95 PIX_FMT_MONOBLACK, ///< Y , 1bpp, 0 is black, 1 is white95 PIX_FMT_MONOBLACK, ///< Y , 1bpp, 0 is black, 1 is white
96 PIX_FMT_PAL8, ///< 8 bit with PIX_FMT_RGB32 palette96 PIX_FMT_PAL8, ///< 8 bit with PIX_FMT_RGB32 palette
97 PIX_FMT_YUVJ420P, ///< Planar YUV 4:2:0, 12bpp, full scale (jpeg)97 PIX_FMT_YUVJ420P, ///< planar YUV 4:2:0, 12bpp, full scale (JPEG)
98 PIX_FMT_YUVJ422P, ///< Planar YUV 4:2:2, 16bpp, full scale (jpeg)98 PIX_FMT_YUVJ422P, ///< planar YUV 4:2:2, 16bpp, full scale (JPEG)
99 PIX_FMT_YUVJ444P, ///< Planar YUV 4:4:4, 24bpp, full scale (jpeg)99 PIX_FMT_YUVJ444P, ///< planar YUV 4:4:4, 24bpp, full scale (JPEG)
100 PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing(xvmc_render.h)100 PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing(xvmc_render.h)
101 PIX_FMT_XVMC_MPEG2_IDCT,101 PIX_FMT_XVMC_MPEG2_IDCT,
102 PIX_FMT_UYVY422, ///< Packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1102 PIX_FMT_UYVY422, ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
103 PIX_FMT_UYYVYY411, ///< Packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3103 PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3
104 PIX_FMT_BGR32, ///< Packed RGB 8:8:8, 32bpp, (msb)8A 8B 8G 8R(lsb), in cpu endianness104 PIX_FMT_BGR32, ///< packed RGB 8:8:8, 32bpp, (msb)8A 8B 8G 8R(lsb), in CPU endianness
105 PIX_FMT_BGR565, ///< Packed RGB 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), in cpu endianness105 PIX_FMT_BGR565, ///< packed RGB 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), in CPU endianness
106 PIX_FMT_BGR555, ///< Packed RGB 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), in cpu endianness most significant bit to 1106 PIX_FMT_BGR555, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), in CPU endianness, most significant bit to 1
107 PIX_FMT_BGR8, ///< Packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)107 PIX_FMT_BGR8, ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
108 PIX_FMT_BGR4, ///< Packed RGB 1:2:1, 4bpp, (msb)1B 2G 1R(lsb)108 PIX_FMT_BGR4, ///< packed RGB 1:2:1, 4bpp, (msb)1B 2G 1R(lsb)
109 PIX_FMT_BGR4_BYTE, ///< Packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb)109 PIX_FMT_BGR4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb)
110 PIX_FMT_RGB8, ///< Packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb)110 PIX_FMT_RGB8, ///< packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb)
111 PIX_FMT_RGB4, ///< Packed RGB 1:2:1, 4bpp, (msb)1R 2G 1B(lsb)111 PIX_FMT_RGB4, ///< packed RGB 1:2:1, 4bpp, (msb)1R 2G 1B(lsb)
112 PIX_FMT_RGB4_BYTE, ///< Packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb)112 PIX_FMT_RGB4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb)
113 PIX_FMT_NV12, ///< Planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 for UV113 PIX_FMT_NV12, ///< planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 for UV
114 PIX_FMT_NV21, ///< as above, but U and V bytes are swapped114 PIX_FMT_NV21, ///< as above, but U and V bytes are swapped
115 115
116 PIX_FMT_RGB32_1, ///< Packed RGB 8:8:8, 32bpp, (msb)8R 8G 8B 8A(lsb), in cpu endianness116 PIX_FMT_RGB32_1, ///< packed RGB 8:8:8, 32bpp, (msb)8R 8G 8B 8A(lsb), in CPU endianness
117 PIX_FMT_BGR32_1, ///< Packed RGB 8:8:8, 32bpp, (msb)8B 8G 8R 8A(lsb), in cpu endianness117 PIX_FMT_BGR32_1, ///< packed RGB 8:8:8, 32bpp, (msb)8B 8G 8R 8A(lsb), in CPU endianness
118 118
119 PIX_FMT_GRAY16BE, ///< Y , 16bpp, big-endian119 PIX_FMT_GRAY16BE, ///< Y , 16bpp, big-endian
120 PIX_FMT_GRAY16LE, ///< Y , 16bpp, little-endian120 PIX_FMT_GRAY16LE, ///< Y , 16bpp, little-endian
121 PIX_FMT_YUV440P, ///< Planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)121 PIX_FMT_YUV440P, ///< planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
122 PIX_FMT_YUVJ440P, ///< Planar YUV 4:4:0 full scale (jpeg)122 PIX_FMT_YUVJ440P, ///< planar YUV 4:4:0 full scale (JPEG)
123 PIX_FMT_YUVA420P, ///< Planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)123 PIX_FMT_YUVA420P, ///< planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
124 PIX_FMT_VDPAU_H264,///< H264 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers124 PIX_FMT_VDPAU_H264,///< H.264 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
125 PIX_FMT_VDPAU_MPEG1,///< MPEG1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers125 PIX_FMT_VDPAU_MPEG1,///< MPEG-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
126 PIX_FMT_VDPAU_MPEG2,///< MPEG2 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers126 PIX_FMT_VDPAU_MPEG2,///< MPEG-2 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
127 PIX_FMT_VDPAU_WMV3,///< WMV3 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers127 PIX_FMT_VDPAU_WMV3,///< WMV3 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
128 PIX_FMT_VDPAU_VC1, ///< VC1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers128 PIX_FMT_VDPAU_VC1, ///< VC-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
129 PIX_FMT_NB, ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions129 PIX_FMT_NB, ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions
130};130};
131 131
libavutil/bswap.h+2−2
@@ -77,8 +77,8 @@ static inline uint64_t av_const bswap_64(uint64_t x) · 76 unmodified lines
77}77}
78#endif78#endif
79 79
80// be2me ... BigEndian to MachineEndian80// be2me ... big-endian to machine-endian
81// le2me ... LittleEndian to MachineEndian81// le2me ... little-endian to machine-endian
82 82
83#ifdef WORDS_BIGENDIAN83#ifdef WORDS_BIGENDIAN
84#define be2me_16(x) (x)84#define be2me_16(x) (x)
libavutil/common.h+12−12
@@ -93,7 +93,7 @@ · 92 unmodified lines
93#endif93#endif
94#endif94#endif
95 95
96//rounded divison & shift96//rounded division & shift
97#define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b))97#define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b))
98/* assume b>0 */98/* assume b>0 */
99#define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b))99#define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b))
@@ -140,7 +140,7 @@ static inline av_const int av_log2_16bit(unsigned int v) · 40 unmodified lines
140}140}
141 141
142/**142/**
143 * clip a signed integer value into the amin-amax range143 * Clips a signed integer value into the amin-amax range.
144 * @param a value to clip144 * @param a value to clip
145 * @param amin minimum value of the clip range145 * @param amin minimum value of the clip range
146 * @param amax maximum value of the clip range146 * @param amax maximum value of the clip range
@@ -154,7 +154,7 @@ static inline av_const int av_clip(int a, int amin, int amax) · 7 unmodified lines
154}154}
155 155
156/**156/**
157 * clip a signed integer value into the 0-255 range157 * Clips a signed integer value into the 0-255 range.
158 * @param a value to clip158 * @param a value to clip
159 * @return clipped value159 * @return clipped value
160 */160 */
@@ -165,7 +165,7 @@ static inline av_const uint8_t av_clip_uint8(int a) · 4 unmodified lines
165}165}
166 166
167/**167/**
168 * clip a signed integer value into the -32768,32767 range168 * Clips a signed integer value into the -32768,32767 range.
169 * @param a value to clip169 * @param a value to clip
170 * @return clipped value170 * @return clipped value
171 */171 */
@@ -176,7 +176,7 @@ static inline av_const int16_t av_clip_int16(int a) · 4 unmodified lines
176}176}
177 177
178/**178/**
179 * clip a float value into the amin-amax range179 * Clips a float value into the amin-amax range.
180 * @param a value to clip180 * @param a value to clip
181 * @param amin minimum value of the clip range181 * @param amin minimum value of the clip range
182 * @param amax maximum value of the clip range182 * @param amax maximum value of the clip range
@@ -194,7 +194,7 @@ static inline av_const float av_clipf(float a, float amin, float amax) · 11 unmodified lines
194 194
195/*!195/*!
196 * \def GET_UTF8(val, GET_BYTE, ERROR)196 * \def GET_UTF8(val, GET_BYTE, ERROR)
197 * converts a UTF-8 character (up to 4 bytes long) to its 32-bit UCS-4 encoded form197 * Converts a UTF-8 character (up to 4 bytes long) to its 32-bit UCS-4 encoded form
198 * \param val is the output and should be of type uint32_t. It holds the converted198 * \param val is the output and should be of type uint32_t. It holds the converted
199 * UCS-4 character and should be a left value.199 * UCS-4 character and should be a left value.
200 * \param GET_BYTE gets UTF-8 encoded bytes from any proper source. It can be200 * \param GET_BYTE gets UTF-8 encoded bytes from any proper source. It can be
@@ -222,19 +222,19 @@ static inline av_const float av_clipf(float a, float amin, float amax) · 21 unmodified lines
222 222
223/*!223/*!
224 * \def PUT_UTF8(val, tmp, PUT_BYTE)224 * \def PUT_UTF8(val, tmp, PUT_BYTE)
225 * converts a 32-bit unicode character to its UTF-8 encoded form (up to 4 bytes long).225 * Converts a 32-bit Unicode character to its UTF-8 encoded form (up to 4 bytes long).
226 * \param val is an input only argument and should be of type uint32_t. It holds226 * \param val is an input-only argument and should be of type uint32_t. It holds
227 * a ucs4 encoded unicode character that is to be converted to UTF-8. If227 * a UCS-4 encoded Unicode character that is to be converted to UTF-8. If
228 * val is given as a function it's executed only once.228 * val is given as a function it is executed only once.
229 * \param tmp is a temporary variable and should be of type uint8_t. It229 * \param tmp is a temporary variable and should be of type uint8_t. It
230 * represents an intermediate value during conversion that is to be230 * represents an intermediate value during conversion that is to be
231 * outputted by PUT_BYTE.231 * output by PUT_BYTE.
232 * \param PUT_BYTE writes the converted UTF-8 bytes to any proper destination.232 * \param PUT_BYTE writes the converted UTF-8 bytes to any proper destination.
233 * It could be a function or a statement, and uses tmp as the input byte.233 * It could be a function or a statement, and uses tmp as the input byte.
234 * For example, PUT_BYTE could be "*output++ = tmp;" PUT_BYTE will be234 * For example, PUT_BYTE could be "*output++ = tmp;" PUT_BYTE will be
235 * executed up to 4 times for values in the valid UTF-8 range and up to235 * executed up to 4 times for values in the valid UTF-8 range and up to
236 * 7 times in the general case, depending on the length of the converted236 * 7 times in the general case, depending on the length of the converted
237 * unicode character.237 * Unicode character.
238 */238 */
239#define PUT_UTF8(val, tmp, PUT_BYTE)\239#define PUT_UTF8(val, tmp, PUT_BYTE)\
240 {\240 {\
libavutil/crc.c+3−3
@@ -86,7 +86,7 @@ int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size){ · 85 unmodified lines
86}86}
87 87
88/**88/**
89 * Get an initialized standard CRC table.89 * Gets an initialized standard CRC table.
90 * @param crc_id ID of a standard CRC90 * @param crc_id ID of a standard CRC
91 * @return a pointer to the CRC table or NULL on failure91 * @return a pointer to the CRC table or NULL on failure
92 */92 */
@@ -104,8 +104,8 @@ const AVCRC *av_crc_get_table(AVCRCId crc_id){ · 11 unmodified lines
104}104}
105 105
106/**106/**
107 * Calculate the CRC of a block107 * Calculates the CRC of a block.
108 * @param crc CRC of previous blocks if any or initial value for CRC.108 * @param crc CRC of previous blocks if any or initial value for CRC
109 * @return CRC updated with the data from the given block109 * @return CRC updated with the data from the given block
110 *110 *
111 * @see av_crc_init() "le" parameter111 * @see av_crc_init() "le" parameter
libavutil/crc.h+1−1
@@ -33,7 +33,7 @@ typedef enum { · 32 unmodified lines
33 AV_CRC_16_CCITT,33 AV_CRC_16_CCITT,
34 AV_CRC_32_IEEE,34 AV_CRC_32_IEEE,
35 AV_CRC_32_IEEE_LE, /*< reversed bitorder version of AV_CRC_32_IEEE */35 AV_CRC_32_IEEE_LE, /*< reversed bitorder version of AV_CRC_32_IEEE */
36 AV_CRC_MAX, /*< not part of public API! don't use outside lavu */36 AV_CRC_MAX, /*< Not part of public API! Do not use outside libavutil. */
37}AVCRCId;37}AVCRCId;
38 38
39int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size);39int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size);
libavutil/fifo.c+2−2
@@ -1,5 +1,5 @@
1/*1/*
2 * A very simple circular buffer FIFO implementation2 * a very simple circular buffer FIFO implementation
3 * Copyright (c) 2000, 2001, 2002 Fabrice Bellard3 * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
4 * Copyright (c) 2006 Roman Shaposhnik4 * Copyright (c) 2006 Roman Shaposhnik
5 *5 *
@@ -117,7 +117,7 @@ int av_fifo_generic_read(AVFifoBuffer *f, int buf_size, void (*func)(void*, void · 111 unmodified lines
117 return 0;117 return 0;
118}118}
119 119
120/** discard data from the fifo */120/** Discard data from the FIFO. */
121void av_fifo_drain(AVFifoBuffer *f, int size)121void av_fifo_drain(AVFifoBuffer *f, int size)
122{122{
123 f->rptr += size;123 f->rptr += size;
libavutil/fifo.h+7−7
@@ -18,7 +18,7 @@ · 17 unmodified lines
18 18
19/**19/**
20 * @file fifo.h20 * @file fifo.h
21 * A very simple circular buffer FIFO implementation.21 * a very simple circular buffer FIFO implementation
22 */22 */
23 23
24#ifndef AVUTIL_FIFO_H24#ifndef AVUTIL_FIFO_H
@@ -64,7 +64,7 @@ int av_fifo_size(AVFifoBuffer *f); · 39 unmodified lines
64int av_fifo_read(AVFifoBuffer *f, uint8_t *buf, int buf_size);64int av_fifo_read(AVFifoBuffer *f, uint8_t *buf, int buf_size);
65 65
66/**66/**
67 * Feeds data from an AVFifoBuffer to a user supplied callback.67 * Feeds data from an AVFifoBuffer to a user-supplied callback.
68 * @param *f AVFifoBuffer to read from68 * @param *f AVFifoBuffer to read from
69 * @param buf_size number of bytes to read69 * @param buf_size number of bytes to read
70 * @param *func generic read function70 * @param *func generic read function
@@ -83,16 +83,16 @@ attribute_deprecated void av_fifo_write(AVFifoBuffer *f, const uint8_t *buf, int · 12 unmodified lines
83#endif83#endif
84 84
85/**85/**
86 * Feeds data from a user supplied callback to an AVFifoBuffer.86 * Feeds data from a user-supplied callback to an AVFifoBuffer.
87 * @param *f AVFifoBuffer to write to87 * @param *f AVFifoBuffer to write to
88 * @param *src data source88 * @param *src data source
89 * @param size number of bytes to write89 * @param size number of bytes to write
90 * @param *func generic write function. First parameter is src,90 * @param *func generic write function; the first parameter is src,
91 * second is dest_buf, third is dest_buf_size.91 * the second is dest_buf, the third is dest_buf_size.
92 * func must return the number of bytes written to dest_buf, or <= 0 to92 * func must return the number of bytes written to dest_buf, or <= 0 to
93 * indicate no more data available to write.93 * indicate no more data available to write.
94 * If func is NULL, src is interpreted as a simple byte array for source data.94 * If func is NULL, src is interpreted as a simple byte array for source data.
95 * @return the number of bytes written to the fifo.95 * @return the number of bytes written to the FIFO
96 */96 */
97int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void*, void*, int));97int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void*, void*, int));
98 98
@@ -110,7 +110,7 @@ attribute_deprecated void av_fifo_realloc(AVFifoBuffer *f, unsigned int size); · 11 unmodified lines
110 * Resizes an AVFifoBuffer.110 * Resizes an AVFifoBuffer.
111 * @param *f AVFifoBuffer to resize111 * @param *f AVFifoBuffer to resize
112 * @param size new AVFifoBuffer size in bytes112 * @param size new AVFifoBuffer size in bytes
113 * @return <0 for failure >=0 otherwise113 * @return <0 for failure, >=0 otherwise
114 */114 */
115int av_fifo_realloc2(AVFifoBuffer *f, unsigned int size);115int av_fifo_realloc2(AVFifoBuffer *f, unsigned int size);
116 116
libavutil/integer.c+1−1
@@ -21,7 +21,7 @@ · 20 unmodified lines
21 21
22/**22/**
23 * @file integer.c23 * @file integer.c
24 * arbitrary precision integers.24 * arbitrary precision integers
25 * @author Michael Niedermayer <michaelni@gmx.at>25 * @author Michael Niedermayer <michaelni@gmx.at>
26 */26 */
27 27
libavutil/integer.h+8−7
@@ -48,29 +48,30 @@ int av_log2_i(AVInteger a) av_const; · 47 unmodified lines
48AVInteger av_mul_i(AVInteger a, AVInteger b) av_const;48AVInteger av_mul_i(AVInteger a, AVInteger b) av_const;
49 49
50/**50/**
51 * returns 0 if a==b, 1 if a>b and -1 if a<b.51 * Returns 0 if a==b, 1 if a>b and -1 if a<b.
52 */52 */
53int av_cmp_i(AVInteger a, AVInteger b) av_const;53int av_cmp_i(AVInteger a, AVInteger b) av_const;
54 54
55/**55/**
56 * bitwise shift.56 * bitwise shift
57 * @param s the number of bits by which the value should be shifted right, may be negative for shifting left57 * @param s the number of bits by which the value should be shifted right,
58 may be negative for shifting left
58 */59 */
59AVInteger av_shr_i(AVInteger a, int s) av_const;60AVInteger av_shr_i(AVInteger a, int s) av_const;
60 61
61/**62/**
62 * returns a % b.63 * Returns a % b.
63 * @param quot a/b will be stored here64 * @param quot a/b will be stored here.
64 */65 */
65AVInteger av_mod_i(AVInteger *quot, AVInteger a, AVInteger b);66AVInteger av_mod_i(AVInteger *quot, AVInteger a, AVInteger b);
66 67
67/**68/**
68 * returns a/b.69 * Returns a/b.
69 */70 */
70AVInteger av_div_i(AVInteger a, AVInteger b) av_const;71AVInteger av_div_i(AVInteger a, AVInteger b) av_const;
71 72
72/**73/**
73 * converts the given int64_t to an AVInteger.74 * Converts the given int64_t to an AVInteger.
74 */75 */
75AVInteger av_int2i(int64_t a) av_const;76AVInteger av_int2i(int64_t a) av_const;
76 77
libavutil/internal.h+1−1
@@ -20,7 +20,7 @@ · 19 unmodified lines
20 20
21/**21/**
22 * @file internal.h22 * @file internal.h
23 * common internal api header.23 * common internal API header
24 */24 */
25 25
26#ifndef AVUTIL_INTERNAL_H26#ifndef AVUTIL_INTERNAL_H
libavutil/intfloat_readwrite.c+2−2
@@ -22,7 +22,7 @@ · 21 unmodified lines
22 22
23/**23/**
24 * @file intfloat_readwrite.c24 * @file intfloat_readwrite.c
25 * Portable IEEE float/double read/write functions.25 * portable IEEE float/double read/write functions
26 */26 */
27 27
28#include "common.h"28#include "common.h"
@@ -51,7 +51,7 @@ double av_ext2dbl(const AVExtFloat ext){ · 22 unmodified lines
51 return 0.0/0.0;51 return 0.0/0.0;
52 e -= 16383 + 63; /* In IEEE 80 bits, the whole (i.e. 1.xxxx)52 e -= 16383 + 63; /* In IEEE 80 bits, the whole (i.e. 1.xxxx)
53 * mantissa bit is written as opposed to the53 * mantissa bit is written as opposed to the
54 * single and double precision formats */54 * single and double precision formats. */
55 if (ext.exponent[0]&0x80)55 if (ext.exponent[0]&0x80)
56 m= -m;56 m= -m;
57 return ldexp(m, e);57 return ldexp(m, e);
libavutil/lfg.h+3−3
@@ -30,7 +30,7 @@ typedef struct { · 29 unmodified lines
30void av_lfg_init(AVLFG *c, unsigned int seed);30void av_lfg_init(AVLFG *c, unsigned int seed);
31 31
32/**32/**
33 * Gets the next random unsigned 32bit number using a ALFG.33 * Gets the next random unsigned 32-bit number using an ALFG.
34 *34 *
35 * Please also consider a simple LCG like state= state*1664525+1013904223,35 * Please also consider a simple LCG like state= state*1664525+1013904223,
36 * it may be good enough and faster for your specific use case.36 * it may be good enough and faster for your specific use case.
@@ -41,9 +41,9 @@ static inline unsigned int av_lfg_get(AVLFG *c){ · 4 unmodified lines
41}41}
42 42
43/**43/**
44 * Gets the next random unsigned 32bit number using a MLFG.44 * Gets the next random unsigned 32-bit number using a MLFG.
45 *45 *
46 * Please also consider the av_lfg_get() above, it is faster.46 * Please also consider av_lfg_get() above, it is faster.
47 */47 */
48static inline unsigned int av_mlfg_get(AVLFG *c){48static inline unsigned int av_mlfg_get(AVLFG *c){
49 unsigned int a= c->state[(c->index-55) & 63];49 unsigned int a= c->state[(c->index-55) & 63];
libavutil/lzo.c+10−10
@@ -19,14 +19,14 @@ · 18 unmodified lines
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */20 */
21#include "common.h"21#include "common.h"
22//! avoid e.g. MPlayers fast_memcpy, it slows things down here22//! Avoid e.g. MPlayers fast_memcpy, it slows things down here.
23#undef memcpy23#undef memcpy
24#include <string.h>24#include <string.h>
25#include "lzo.h"25#include "lzo.h"
26 26
27//! define if we may write up to 12 bytes beyond the output buffer27//! Define if we may write up to 12 bytes beyond the output buffer.
28#define OUTBUF_PADDED 128#define OUTBUF_PADDED 1
29//! define if we may read up to 8 bytes beyond the input buffer29//! Define if we may read up to 8 bytes beyond the input buffer.
30#define INBUF_PADDED 130#define INBUF_PADDED 1
31typedef struct LZOContext {31typedef struct LZOContext {
32 const uint8_t *in, *in_end;32 const uint8_t *in, *in_end;
@@ -52,7 +52,7 @@ static inline int get_byte(LZOContext *c) { · 19 unmodified lines
52#endif52#endif
53 53
54/**54/**
55 * \brief decode a length value in the coding used by lzo55 * \brief Decodes a length value in the coding used by lzo.
56 * \param x previous byte value56 * \param x previous byte value
57 * \param mask bits used from x57 * \param mask bits used from x
58 * \return decoded length value58 * \return decoded length value
@@ -80,7 +80,7 @@ static inline int get_len(LZOContext *c, int x, int mask) { · 21 unmodified lines
80#endif80#endif
81 81
82/**82/**
83 * \brief copy bytes from input to output buffer with checking83 * \brief Copies bytes from input to output buffer with checking.
84 * \param cnt number of bytes to copy, must be >= 084 * \param cnt number of bytes to copy, must be >= 0
85 */85 */
86static inline void copy(LZOContext *c, int cnt) {86static inline void copy(LZOContext *c, int cnt) {
@@ -109,7 +109,7 @@ static inline void copy(LZOContext *c, int cnt) { · 22 unmodified lines
109static inline void memcpy_backptr(uint8_t *dst, int back, int cnt);109static inline void memcpy_backptr(uint8_t *dst, int back, int cnt);
110 110
111/**111/**
112 * \brief copy previously decoded bytes to current position112 * \brief Copies previously decoded bytes to current position.
113 * \param back how many bytes back we start113 * \param back how many bytes back we start
114 * \param cnt number of bytes to copy, must be >= 0114 * \param cnt number of bytes to copy, must be >= 0
115 *115 *
@@ -179,15 +179,15 @@ void av_memcpy_backptr(uint8_t *dst, int back, int cnt) { · 63 unmodified lines
179}179}
180 180
181/**181/**
182 * \brief decode LZO 1x compressed data182 * \brief Decodes LZO 1x compressed data.
183 * \param out output buffer183 * \param out output buffer
184 * \param outlen size of output buffer, number of bytes left are returned here184 * \param outlen size of output buffer, number of bytes left are returned here
185 * \param in input buffer185 * \param in input buffer
186 * \param inlen size of input buffer, number of bytes left are returned here186 * \param inlen size of input buffer, number of bytes left are returned here
187 * \return 0 on success, otherwise error flags, see lzo.h187 * \return 0 on success, otherwise error flags, see lzo.h
188 *188 *
189 * make sure all buffers are appropriately padded, in must provide189 * Make sure all buffers are appropriately padded, in must provide
190 * LZO_INPUT_PADDING, out must provide LZO_OUTPUT_PADDING additional bytes190 * LZO_INPUT_PADDING, out must provide LZO_OUTPUT_PADDING additional bytes.
191 */191 */
192int lzo1x_decode(void *out, int *outlen, const void *in, int *inlen) {192int lzo1x_decode(void *out, int *outlen, const void *in, int *inlen) {
193 int state= 0;193 int state= 0;
@@ -285,7 +285,7 @@ STOP_TIMER("lzod") · 91 unmodified lines
285 if (memcmp(orig, decomp, s))285 if (memcmp(orig, decomp, s))
286 av_log(NULL, AV_LOG_ERROR, "decompression incorrect\n");286 av_log(NULL, AV_LOG_ERROR, "decompression incorrect\n");
287 else287 else
288 av_log(NULL, AV_LOG_ERROR, "decompression ok\n");288 av_log(NULL, AV_LOG_ERROR, "decompression OK\n");
289 return 0;289 return 0;
290}290}
291#endif291#endif
libavutil/mathematics.c+1−1
@@ -20,7 +20,7 @@ · 19 unmodified lines
20 20
21/**21/**
22 * @file mathematics.c22 * @file mathematics.c
23 * Miscellaneous math routines and tables.23 * miscellaneous math routines and tables
24 */24 */
25 25
26#include <assert.h>26#include <assert.h>
libavutil/mathematics.h+10−10
@@ -42,29 +42,29 @@ · 41 unmodified lines
42#endif42#endif
43 43
44enum AVRounding {44enum AVRounding {
45 AV_ROUND_ZERO = 0, ///< round toward zero45 AV_ROUND_ZERO = 0, ///< Round toward zero.
46 AV_ROUND_INF = 1, ///< round away from zero46 AV_ROUND_INF = 1, ///< Round away from zero.
47 AV_ROUND_DOWN = 2, ///< round toward -infinity47 AV_ROUND_DOWN = 2, ///< Round toward -infinity.
48 AV_ROUND_UP = 3, ///< round toward +infinity48 AV_ROUND_UP = 3, ///< Round toward +infinity.
49 AV_ROUND_NEAR_INF = 5, ///< round to nearest and halfway cases away from zero49 AV_ROUND_NEAR_INF = 5, ///< Round to nearest and halfway cases away from zero.
50};50};
51 51
52int64_t av_const av_gcd(int64_t a, int64_t b);52int64_t av_const av_gcd(int64_t a, int64_t b);
53 53
54/**54/**
55 * rescale a 64bit integer with rounding to nearest.55 * Rescales a 64-bit integer with rounding to nearest.
56 * a simple a*b/c isn't possible as it can overflow56 * A simple a*b/c isn't possible as it can overflow.
57 */57 */
58int64_t av_rescale(int64_t a, int64_t b, int64_t c) av_const;58int64_t av_rescale(int64_t a, int64_t b, int64_t c) av_const;
59 59
60/**60/**
61 * rescale a 64bit integer with specified rounding.61 * Rescales a 64-bit integer with specified rounding.
62 * a simple a*b/c isn't possible as it can overflow62 * A simple a*b/c isn't possible as it can overflow.
63 */63 */
64int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding) av_const;64int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding) av_const;
65 65
66/**66/**
67 * rescale a 64bit integer by 2 rational numbers.67 * Rescales a 64-bit integer by 2 rational numbers.
68 */68 */
69int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) av_const;69int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) av_const;
70 70
libavutil/md5.c+8−8
@@ -43,29 +43,29 @@ typedef struct AVMD5{ · 42 unmodified lines
43const int av_md5_size= sizeof(AVMD5);43const int av_md5_size= sizeof(AVMD5);
44 44
45static const uint8_t S[4][4] = {45static const uint8_t S[4][4] = {
46 { 7, 12, 17, 22 }, /* Round 1 */46 { 7, 12, 17, 22 }, /* round 1 */
47 { 5, 9, 14, 20 }, /* Round 2 */47 { 5, 9, 14, 20 }, /* round 2 */
48 { 4, 11, 16, 23 }, /* Round 3 */48 { 4, 11, 16, 23 }, /* round 3 */
49 { 6, 10, 15, 21 } /* Round 4 */49 { 6, 10, 15, 21 } /* round 4 */
50};50};
51 51
52static const uint32_t T[64] = { // T[i]= fabs(sin(i+1)<<32)52static const uint32_t T[64] = { // T[i]= fabs(sin(i+1)<<32)
53 0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee, /* Round 1 */53 0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee, /* round 1 */
54 0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501,54 0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501,
55 0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be,55 0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be,
56 0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821,56 0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821,
57 57
58 0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa, /* Round 2 */58 0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa, /* round 2 */
59 0xd62f105d, 0x02441453, 0xd8a1e681, 0xe7d3fbc8,59 0xd62f105d, 0x02441453, 0xd8a1e681, 0xe7d3fbc8,
60 0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed,60 0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed,
61 0xa9e3e905, 0xfcefa3f8, 0x676f02d9, 0x8d2a4c8a,61 0xa9e3e905, 0xfcefa3f8, 0x676f02d9, 0x8d2a4c8a,
62 62
63 0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c, /* Round 3 */63 0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c, /* round 3 */
64 0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70,64 0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70,
65 0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x04881d05,65 0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x04881d05,
66 0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665,66 0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665,
67 67
68 0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039, /* Round 4 */68 0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039, /* round 4 */
69 0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1,69 0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1,
70 0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1,70 0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1,
71 0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391,71 0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391,
libavutil/mem.c+8−8
@@ -21,7 +21,7 @@ · 20 unmodified lines
21 21
22/**22/**
23 * @file mem.c23 * @file mem.c
24 * default memory allocator for libavutil.24 * default memory allocator for libavutil
25 */25 */
26 26
27#include "config.h"27#include "config.h"
@@ -35,14 +35,14 @@ · 7 unmodified lines
35 35
36#include "mem.h"36#include "mem.h"
37 37
38/* here we can use OS dependent allocation functions */38/* here we can use OS-dependent allocation functions */
39#undef free39#undef free
40#undef malloc40#undef malloc
41#undef realloc41#undef realloc
42 42
43/* you can redefine av_malloc and av_free in your project to use your43/* You can redefine av_malloc and av_free in your project to use your
44 memory allocator. You do not need to suppress this file because the44 memory allocator. You do not need to suppress this file because the
45 linker will do it automatically */45 linker will do it automatically. */
46 46
47void *av_malloc(unsigned int size)47void *av_malloc(unsigned int size)
48{48{
@@ -70,7 +70,7 @@ void *av_malloc(unsigned int size) · 21 unmodified lines
70 Indeed, we should align it:70 Indeed, we should align it:
71 on 4 for 38671 on 4 for 386
72 on 16 for 48672 on 16 for 486
73 on 32 for 586, PPro - k6-III73 on 32 for 586, PPro - K6-III
74 on 64 for K7 (maybe for P3 too).74 on 64 for K7 (maybe for P3 too).
75 Because L1 and L2 caches are aligned on those values.75 Because L1 and L2 caches are aligned on those values.
76 But I don't want to code such logic here!76 But I don't want to code such logic here!
@@ -78,10 +78,10 @@ void *av_malloc(unsigned int size) · 1 unmodified line
78 /* Why 16?78 /* Why 16?
79 Because some CPUs need alignment, for example SSE2 on P4, & most RISC CPUs79 Because some CPUs need alignment, for example SSE2 on P4, & most RISC CPUs
80 it will just trigger an exception and the unaligned load will be done in the80 it will just trigger an exception and the unaligned load will be done in the
81 exception handler or it will just segfault (SSE2 on P4)81 exception handler or it will just segfault (SSE2 on P4).
82 Why not larger? Because I did not see a difference in benchmarks ...82 Why not larger? Because I did not see a difference in benchmarks ...
83 */83 */
84 /* benchmarks with p384 /* benchmarks with P3
85 memalign(64)+1 3071,3051,303285 memalign(64)+1 3071,3051,3032
86 memalign(64)+2 3051,3032,304186 memalign(64)+2 3051,3032,3041
87 memalign(64)+4 2911,2896,291587 memalign(64)+4 2911,2896,2915
@@ -90,7 +90,7 @@ void *av_malloc(unsigned int size) · 2 unmodified lines
90 memalign(64)+32 2546,2545,257190 memalign(64)+32 2546,2545,2571
91 memalign(64)+64 2570,2533,255891 memalign(64)+64 2570,2533,2558
92 92
93 btw, malloc seems to do 8 byte alignment by default here93 BTW, malloc seems to do 8-byte alignment by default here.
94 */94 */
95#else95#else
96 ptr = malloc(size);96 ptr = malloc(size);
libavutil/mem.h+18−19
@@ -20,7 +20,7 @@ · 19 unmodified lines
20 20
21/**21/**
22 * @file mem.h22 * @file mem.h
23 * Memory handling functions.23 * memory handling functions
24 */24 */
25 25
26#ifndef AVUTIL_MEM_H26#ifndef AVUTIL_MEM_H
@@ -41,31 +41,31 @@ · 14 unmodified lines
41#endif41#endif
42 42
43/**43/**
44 * Allocate a block of \p size bytes with alignment suitable for all44 * Allocates a block of \p size bytes with alignment suitable for all
45 * memory accesses (including vectors if available on the CPU).45 * memory accesses (including vectors if available on the CPU).
46 * @param size Size in bytes for the memory block to be allocated.46 * @param size Size in bytes for the memory block to be allocated.
47 * @return Pointer to the allocated block, NULL if it cannot allocate47 * @return Pointer to the allocated block, NULL if the block cannot
48 * it.48 * be allocated.
49 * @see av_mallocz()49 * @see av_mallocz()
50 */50 */
51void *av_malloc(unsigned int size) av_malloc_attrib av_alloc_size(1);51void *av_malloc(unsigned int size) av_malloc_attrib av_alloc_size(1);
52 52
53/**53/**
54 * Allocate or reallocate a block of memory.54 * Allocates or reallocates a block of memory.
55 * If \p ptr is NULL and \p size > 0, allocate a new block. If \p55 * If \p ptr is NULL and \p size > 0, allocates a new block. If \p
56 * size is zero, free the memory block pointed by \p ptr.56 * size is zero, frees the memory block pointed to by \p ptr.
57 * @param size Size in bytes for the memory block to be allocated or57 * @param size Size in bytes for the memory block to be allocated or
58 * reallocated.58 * reallocated.
59 * @param ptr Pointer to a memory block already allocated with59 * @param ptr Pointer to a memory block already allocated with
60 * av_malloc(z)() or av_realloc() or NULL.60 * av_malloc(z)() or av_realloc() or NULL.
61 * @return Pointer to a newly reallocated block or NULL if it cannot61 * @return Pointer to a newly reallocated block or NULL if the block
62 * reallocate or the function is used to free the memory block.62 * cannot be reallocated or the function is used to free the memory block.
63 * @see av_fast_realloc()63 * @see av_fast_realloc()
64 */64 */
65void *av_realloc(void *ptr, unsigned int size) av_alloc_size(2);65void *av_realloc(void *ptr, unsigned int size) av_alloc_size(2);
66 66
67/**67/**
68 * Free a memory block which has been allocated with av_malloc(z)() or68 * Frees a memory block which has been allocated with av_malloc(z)() or
69 * av_realloc().69 * av_realloc().
70 * @param ptr Pointer to the memory block which should be freed.70 * @param ptr Pointer to the memory block which should be freed.
71 * @note ptr = NULL is explicitly allowed.71 * @note ptr = NULL is explicitly allowed.
@@ -75,27 +75,26 @@ void *av_realloc(void *ptr, unsigned int size) av_alloc_size(2); · 3 unmodified lines
75void av_free(void *ptr);75void av_free(void *ptr);
76 76
77/**77/**
78 * Allocate a block of \p size bytes with alignment suitable for all78 * Allocates a block of \p size bytes with alignment suitable for all
79 * memory accesses (including vectors if available on the CPU) and79 * memory accesses (including vectors if available on the CPU) and
80 * set to zeroes all the bytes of the block.80 * zeroes all the bytes of the block.
81 * @param size Size in bytes for the memory block to be allocated.81 * @param size Size in bytes for the memory block to be allocated.
82 * @return Pointer to the allocated block, NULL if it cannot allocate82 * @return Pointer to the allocated block, NULL if it cannot be allocated.
83 * it.
84 * @see av_malloc()83 * @see av_malloc()
85 */84 */
86void *av_mallocz(unsigned int size) av_malloc_attrib av_alloc_size(1);85void *av_mallocz(unsigned int size) av_malloc_attrib av_alloc_size(1);
87 86
88/**87/**
89 * Duplicate the string \p s.88 * Duplicates the string \p s.
90 * @param s String to be duplicated.89 * @param s string to be duplicated
91 * @return Pointer to a newly allocated string containing a90 * @return Pointer to a newly allocated string containing a
92 * copy of \p s or NULL if it cannot be allocated.91 * copy of \p s or NULL if the string cannot be allocated.
93 */92 */
94char *av_strdup(const char *s) av_malloc_attrib;93char *av_strdup(const char *s) av_malloc_attrib;
95 94
96/**95/**
97 * Free a memory block which has been allocated with av_malloc(z)() or96 * Frees a memory block which has been allocated with av_malloc(z)() or
98 * av_realloc() and set to NULL the pointer to it.97 * av_realloc() and set the pointer pointing to it to NULL.
99 * @param ptr Pointer to the pointer to the memory block which should98 * @param ptr Pointer to the pointer to the memory block which should
100 * be freed.99 * be freed.
101 * @see av_free()100 * @see av_free()
libavutil/pca.c+3−3
@@ -1,5 +1,5 @@
1/*1/*
2 * Principal component analysis2 * principal component analysis (PCA)
3 * Copyright (c) 2004 Michael Niedermayer <michaelni@gmx.at>3 * Copyright (c) 2004 Michael Niedermayer <michaelni@gmx.at>
4 *4 *
5 * This file is part of FFmpeg.5 * This file is part of FFmpeg.
@@ -21,7 +21,7 @@ · 15 unmodified lines
21 21
22/**22/**
23 * @file pca.c23 * @file pca.c
24 * Principal component analysis24 * principal component analysis (PCA)
25 */25 */
26 26
27#include "common.h"27#include "common.h"
@@ -120,7 +120,7 @@ int ff_pca(PCA *pca, double *eigenvector, double *eigenvalue){ · 92 unmodified lines
120 120
121 if(pass < 3 && fabs(covar) < sum / (5*n*n)) //FIXME why pass < 3121 if(pass < 3 && fabs(covar) < sum / (5*n*n)) //FIXME why pass < 3
122 continue;122 continue;
123 if(fabs(covar) == 0.0) //FIXME shouldnt be needed123 if(fabs(covar) == 0.0) //FIXME should not be needed
124 continue;124 continue;
125 if(pass >=3 && fabs((eigenvalue[j]+z[j])/covar) > (1LL<<32) && fabs((eigenvalue[i]+z[i])/covar) > (1LL<<32)){125 if(pass >=3 && fabs((eigenvalue[j]+z[j])/covar) > (1LL<<32) && fabs((eigenvalue[i]+z[i])/covar) > (1LL<<32)){
126 pca->covariance[j + i*n]=0.0;126 pca->covariance[j + i*n]=0.0;
libavutil/pca.h+2−2
@@ -1,5 +1,5 @@
1/*1/*
2 * Principal component analysis2 * principal component analysis (PCA)
3 * Copyright (c) 2004 Michael Niedermayer <michaelni@gmx.at>3 * Copyright (c) 2004 Michael Niedermayer <michaelni@gmx.at>
4 *4 *
5 * This file is part of FFmpeg.5 * This file is part of FFmpeg.
@@ -21,7 +21,7 @@ · 15 unmodified lines
21 21
22/**22/**
23 * @file pca.h23 * @file pca.h
24 * Principal component analysis24 * principal component analysis (PCA)
25 */25 */
26 26
27#ifndef AVUTIL_PCA_H27#ifndef AVUTIL_PCA_H
libavutil/random.c+3−3
@@ -29,19 +29,19 @@ see http://en.wikipedia.org/wiki/Mersenne_twister for an explanation of this alg · 28 unmodified lines
29#include "random.h"29#include "random.h"
30 30
31 31
32/* Period parameters */32/* period parameters */
33#define M 39733#define M 397
34#define A 0x9908b0df /* constant vector a */34#define A 0x9908b0df /* constant vector a */
35#define UPPER_MASK 0x80000000 /* most significant w-r bits */35#define UPPER_MASK 0x80000000 /* most significant w-r bits */
36#define LOWER_MASK 0x7fffffff /* least significant r bits */36#define LOWER_MASK 0x7fffffff /* least significant r bits */
37 37
38/** initializes mt[AV_RANDOM_N] with a seed */38/** Initializes mt[AV_RANDOM_N] with a seed. */
39void av_random_init(AVRandomState *state, unsigned int seed)39void av_random_init(AVRandomState *state, unsigned int seed)
40{40{
41 int index;41 int index;
42 42
43 /*43 /*
44 This differs from the wikipedia article. Source is from the44 This differs from the Wikipedia article. Source is from the
45 Makoto Matsumoto and Takuji Nishimura code, with the following comment:45 Makoto Matsumoto and Takuji Nishimura code, with the following comment:
46 */46 */
47 /* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */47 /* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */
libavutil/rational.c+2−2
@@ -1,5 +1,5 @@
1/*1/*
2 * Rational numbers2 * rational numbers
3 * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at>3 * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at>
4 *4 *
5 * This file is part of FFmpeg.5 * This file is part of FFmpeg.
@@ -21,7 +21,7 @@ · 15 unmodified lines
21 21
22/**22/**
23 * @file rational.c23 * @file rational.c
24 * Rational numbers24 * rational numbers
25 * @author Michael Niedermayer <michaelni@gmx.at>25 * @author Michael Niedermayer <michaelni@gmx.at>
26 */26 */
27 27
libavutil/rational.h+20−20
@@ -1,5 +1,5 @@
1/*1/*
2 * Rational numbers2 * rational numbers
3 * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at>3 * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at>
4 *4 *
5 * This file is part of FFmpeg.5 * This file is part of FFmpeg.
@@ -21,7 +21,7 @@ · 15 unmodified lines
21 21
22/**22/**
23 * @file rational.h23 * @file rational.h
24 * Rational numbers.24 * rational numbers
25 * @author Michael Niedermayer <michaelni@gmx.at>25 * @author Michael Niedermayer <michaelni@gmx.at>
26 */26 */
27 27
@@ -32,7 +32,7 @@ · 4 unmodified lines
32#include "common.h"32#include "common.h"
33 33
34/**34/**
35 * Rational number num/den.35 * rational number numerator/denominator
36 */36 */
37typedef struct AVRational{37typedef struct AVRational{
38 int num; ///< numerator38 int num; ///< numerator
@@ -40,10 +40,10 @@ typedef struct AVRational{ · 1 unmodified line
40} AVRational;40} AVRational;
41 41
42/**42/**
43 * Compare two rationals.43 * Compares two rationals.
44 * @param a first rational44 * @param a first rational
45 * @param b second rational45 * @param b second rational
46 * @return 0 if a==b, 1 if a>b and -1 if a<b.46 * @return 0 if a==b, 1 if a>b and -1 if a<b
47 */47 */
48static inline int av_cmp_q(AVRational a, AVRational b){48static inline int av_cmp_q(AVRational a, AVRational b){
49 const int64_t tmp= a.num * (int64_t)b.den - b.num * (int64_t)a.den;49 const int64_t tmp= a.num * (int64_t)b.den - b.num * (int64_t)a.den;
@@ -53,7 +53,7 @@ static inline int av_cmp_q(AVRational a, AVRational b){ · 3 unmodified lines
53}53}
54 54
55/**55/**
56 * Rational to double conversion.56 * Converts rational to double.
57 * @param a rational to convert57 * @param a rational to convert
58 * @return (double) a58 * @return (double) a
59 */59 */
@@ -62,7 +62,7 @@ static inline double av_q2d(AVRational a){ · 2 unmodified lines
62}62}
63 63
64/**64/**
65 * Reduce a fraction.65 * Reduces a fraction.
66 * This is useful for framerate calculations.66 * This is useful for framerate calculations.
67 * @param dst_nom destination numerator67 * @param dst_nom destination numerator
68 * @param dst_den destination denominator68 * @param dst_den destination denominator
@@ -75,33 +75,33 @@ int av_reduce(int *dst_nom, int *dst_den, int64_t nom, int64_t den, int64_t max) · 6 unmodified lines
75 75
76/**76/**
77 * Multiplies two rationals.77 * Multiplies two rationals.
78 * @param b first rational.78 * @param b first rational
79 * @param c second rational.79 * @param c second rational
80 * @return b*c.80 * @return b*c
81 */81 */
82AVRational av_mul_q(AVRational b, AVRational c) av_const;82AVRational av_mul_q(AVRational b, AVRational c) av_const;
83 83
84/**84/**
85 * Divides one rational by another.85 * Divides one rational by another.
86 * @param b first rational.86 * @param b first rational
87 * @param c second rational.87 * @param c second rational
88 * @return b/c.88 * @return b/c
89 */89 */
90AVRational av_div_q(AVRational b, AVRational c) av_const;90AVRational av_div_q(AVRational b, AVRational c) av_const;
91 91
92/**92/**
93 * Adds two rationals.93 * Adds two rationals.
94 * @param b first rational.94 * @param b first rational
95 * @param c second rational.95 * @param c second rational
96 * @return b+c.96 * @return b+c
97 */97 */
98AVRational av_add_q(AVRational b, AVRational c) av_const;98AVRational av_add_q(AVRational b, AVRational c) av_const;
99 99
100/**100/**
101 * Subtracts one rational from another.101 * Subtracts one rational from another.
102 * @param b first rational.102 * @param b first rational
103 * @param c second rational.103 * @param c second rational
104 * @return b-c.104 * @return b-c
105 */105 */
106AVRational av_sub_q(AVRational b, AVRational c) av_const;106AVRational av_sub_q(AVRational b, AVRational c) av_const;
107 107
@@ -109,7 +109,7 @@ AVRational av_sub_q(AVRational b, AVRational c) av_const; · 1 unmodified line
109 * Converts a double precision floating point number to a rational.109 * Converts a double precision floating point number to a rational.
110 * @param d double to convert110 * @param d double to convert
111 * @param max the maximum allowed numerator and denominator111 * @param max the maximum allowed numerator and denominator
112 * @return (AVRational) d.112 * @return (AVRational) d
113 */113 */
114AVRational av_d2q(double d, int max) av_const;114AVRational av_d2q(double d, int max) av_const;
115 115
libavutil/sha1.c+1−1
@@ -168,7 +168,7 @@ int main(void){ · 167 unmodified lines
168 printf("%02X", digest[i]);168 printf("%02X", digest[i]);
169 putchar('\n');169 putchar('\n');
170 }170 }
171 //Test Vectors (from FIPS PUB 180-1)171 //test vectors (from FIPS PUB 180-1)
172 printf("A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D\n"172 printf("A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D\n"
173 "84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1\n"173 "84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1\n"
174 "34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F\n");174 "34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F\n");
libavutil/softfloat.h+6−9
@@ -72,10 +72,9 @@ static inline av_const SoftFloat av_normalize1_sf(SoftFloat a){ · 71 unmodified lines
72}72}
73 73
74/**74/**
75 *75 * @return Will not be more denormalized than a+b. So if either input is
76 * @return will not be more denormalized then a+b, so if either input is76 * normalized, then the output will not be worse then the other input.
77 * normalized then the output will not be worse then the other input77 * If both are normalized, then the output will be normalized.
78 * if both are normalized then the output will be normalized
79 */78 */
80static inline av_const SoftFloat av_mul_sf(SoftFloat a, SoftFloat b){79static inline av_const SoftFloat av_mul_sf(SoftFloat a, SoftFloat b){
81 a.exp += b.exp;80 a.exp += b.exp;
@@ -84,9 +83,8 @@ static inline av_const SoftFloat av_mul_sf(SoftFloat a, SoftFloat b){ · 2 unmodified lines
84}83}
85 84
86/**85/**
87 *86 * b has to be normalized and not zero.
88 * b has to be normalized and not zero87 * @return Will not be more denormalized than a.
89 * @return will not be more denormalized then a
90 */88 */
91static av_const SoftFloat av_div_sf(SoftFloat a, SoftFloat b){89static av_const SoftFloat av_div_sf(SoftFloat a, SoftFloat b){
92 a.exp -= b.exp+1;90 a.exp -= b.exp+1;
@@ -117,8 +115,7 @@ static inline av_const SoftFloat av_int2sf(int v, int frac_bits){ · 24 unmodified lines
117}115}
118 116
119/**117/**
120 *118 * Rounding is to -inf.
121 * rounding is to -inf
122 */119 */
123static inline av_const int av_sf2int(SoftFloat v, int frac_bits){120static inline av_const int av_sf2int(SoftFloat v, int frac_bits){
124 v.exp += frac_bits - ONE_BITS;121 v.exp += frac_bits - ONE_BITS;
libavutil/tree.c+1−1
@@ -199,7 +199,7 @@ int main(void){ · 198 unmodified lines
199 av_tree_insert(&root, (void*)(j+1), cmp, &node2);199 av_tree_insert(&root, (void*)(j+1), cmp, &node2);
200 k= av_tree_find(root, (void*)(j+1), cmp, NULL);200 k= av_tree_find(root, (void*)(j+1), cmp, NULL);
201 if(k)201 if(k)
202 av_log(NULL, AV_LOG_ERROR, "removial failure %d\n", i);202 av_log(NULL, AV_LOG_ERROR, "removal failure %d\n", i);
203 }203 }
204 }204 }
205 return 0;205 return 0;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t