diff options
Diffstat (limited to 'media/ffvpx/libavutil')
-rw-r--r-- | media/ffvpx/libavutil/atomic_suncc.h | 54 | ||||
-rw-r--r-- | media/ffvpx/libavutil/avutil.symbols | 3 | ||||
-rw-r--r-- | media/ffvpx/libavutil/display.c | 73 | ||||
-rw-r--r-- | media/ffvpx/libavutil/display.h | 114 | ||||
-rw-r--r-- | media/ffvpx/libavutil/lzo.c | 205 | ||||
-rw-r--r-- | media/ffvpx/libavutil/lzo.h | 66 | ||||
-rw-r--r-- | media/ffvpx/libavutil/motion_vector.h | 57 | ||||
-rw-r--r-- | media/ffvpx/libavutil/moz.build | 1 | ||||
-rw-r--r-- | media/ffvpx/libavutil/wchar_filename.h | 45 |
9 files changed, 0 insertions, 618 deletions
diff --git a/media/ffvpx/libavutil/atomic_suncc.h b/media/ffvpx/libavutil/atomic_suncc.h deleted file mode 100644 index a75a37b47..000000000 --- a/media/ffvpx/libavutil/atomic_suncc.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_ATOMIC_SUNCC_H -#define AVUTIL_ATOMIC_SUNCC_H - -#include <atomic.h> -#include <mbarrier.h> - -#include "atomic.h" - -#define avpriv_atomic_int_get atomic_int_get_suncc -static inline int atomic_int_get_suncc(volatile int *ptr) -{ - __machine_rw_barrier(); - return *ptr; -} - -#define avpriv_atomic_int_set atomic_int_set_suncc -static inline void atomic_int_set_suncc(volatile int *ptr, int val) -{ - *ptr = val; - __machine_rw_barrier(); -} - -#define avpriv_atomic_int_add_and_fetch atomic_int_add_and_fetch_suncc -static inline int atomic_int_add_and_fetch_suncc(volatile int *ptr, int inc) -{ - return atomic_add_int_nv(ptr, inc); -} - -#define avpriv_atomic_ptr_cas atomic_ptr_cas_suncc -static inline void *atomic_ptr_cas_suncc(void * volatile *ptr, - void *oldval, void *newval) -{ - return atomic_cas_ptr(ptr, oldval, newval); -} - -#endif /* AVUTIL_ATOMIC_SUNCC_H */ diff --git a/media/ffvpx/libavutil/avutil.symbols b/media/ffvpx/libavutil/avutil.symbols index fb93143fa..ba68dc33c 100644 --- a/media/ffvpx/libavutil/avutil.symbols +++ b/media/ffvpx/libavutil/avutil.symbols @@ -57,9 +57,6 @@ av_dict_parse_string av_dict_set av_dict_set_int av_dirname -av_display_matrix_flip -av_display_rotation_get -av_display_rotation_set av_div_q av_dynarray2_add av_dynarray_add diff --git a/media/ffvpx/libavutil/display.c b/media/ffvpx/libavutil/display.c deleted file mode 100644 index a0076e067..000000000 --- a/media/ffvpx/libavutil/display.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2014 Vittorio Giovara <vittorio.giovara@gmail.com> - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include <stdint.h> -#include <string.h> -#include <math.h> - -#include "display.h" -#include "mathematics.h" - -// fixed point to double -#define CONV_FP(x) ((double) (x)) / (1 << 16) - -// double to fixed point -#define CONV_DB(x) (int32_t) ((x) * (1 << 16)) - -double av_display_rotation_get(const int32_t matrix[9]) -{ - double rotation, scale[2]; - - scale[0] = hypot(CONV_FP(matrix[0]), CONV_FP(matrix[3])); - scale[1] = hypot(CONV_FP(matrix[1]), CONV_FP(matrix[4])); - - if (scale[0] == 0.0 || scale[1] == 0.0) - return NAN; - - rotation = atan2(CONV_FP(matrix[1]) / scale[1], - CONV_FP(matrix[0]) / scale[0]) * 180 / M_PI; - - return -rotation; -} - -void av_display_rotation_set(int32_t matrix[9], double angle) -{ - double radians = -angle * M_PI / 180.0f; - double c = cos(radians); - double s = sin(radians); - - memset(matrix, 0, 9 * sizeof(int32_t)); - - matrix[0] = CONV_DB(c); - matrix[1] = CONV_DB(-s); - matrix[3] = CONV_DB(s); - matrix[4] = CONV_DB(c); - matrix[8] = 1 << 30; -} - -void av_display_matrix_flip(int32_t matrix[9], int hflip, int vflip) -{ - int i; - const int flip[] = { 1 - 2 * (!!hflip), 1 - 2 * (!!vflip), 1 }; - - if (hflip || vflip) - for (i = 0; i < 9; i++) - matrix[i] *= flip[i % 3]; -} diff --git a/media/ffvpx/libavutil/display.h b/media/ffvpx/libavutil/display.h deleted file mode 100644 index 515adad79..000000000 --- a/media/ffvpx/libavutil/display.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (c) 2014 Vittorio Giovara <vittorio.giovara@gmail.com> - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * Display matrix - */ - -#ifndef AVUTIL_DISPLAY_H -#define AVUTIL_DISPLAY_H - -#include <stdint.h> -#include "common.h" - -/** - * @addtogroup lavu_video - * @{ - * - * @defgroup lavu_video_display Display transformation matrix functions - * @{ - */ - -/** - * @addtogroup lavu_video_display - * The display transformation matrix specifies an affine transformation that - * should be applied to video frames for correct presentation. It is compatible - * with the matrices stored in the ISO/IEC 14496-12 container format. - * - * The data is a 3x3 matrix represented as a 9-element array: - * - * @code{.unparsed} - * | a b u | - * (a, b, u, c, d, v, x, y, w) -> | c d v | - * | x y w | - * @endcode - * - * All numbers are stored in native endianness, as 16.16 fixed-point values, - * except for u, v and w, which are stored as 2.30 fixed-point values. - * - * The transformation maps a point (p, q) in the source (pre-transformation) - * frame to the point (p', q') in the destination (post-transformation) frame as - * follows: - * - * @code{.unparsed} - * | a b u | - * (p, q, 1) . | c d v | = z * (p', q', 1) - * | x y w | - * @endcode - * - * The transformation can also be more explicitly written in components as - * follows: - * - * @code{.unparsed} - * p' = (a * p + c * q + x) / z; - * q' = (b * p + d * q + y) / z; - * z = u * p + v * q + w - * @endcode - */ - -/** - * Extract the rotation component of the transformation matrix. - * - * @param matrix the transformation matrix - * @return the angle (in degrees) by which the transformation rotates the frame - * counterclockwise. The angle will be in range [-180.0, 180.0], - * or NaN if the matrix is singular. - * - * @note floating point numbers are inherently inexact, so callers are - * recommended to round the return value to nearest integer before use. - */ -double av_display_rotation_get(const int32_t matrix[9]); - -/** - * Initialize a transformation matrix describing a pure counterclockwise - * rotation by the specified angle (in degrees). - * - * @param matrix an allocated transformation matrix (will be fully overwritten - * by this function) - * @param angle rotation angle in degrees. - */ -void av_display_rotation_set(int32_t matrix[9], double angle); - -/** - * Flip the input matrix horizontally and/or vertically. - * - * @param matrix an allocated transformation matrix - * @param hflip whether the matrix should be flipped horizontally - * @param vflip whether the matrix should be flipped vertically - */ -void av_display_matrix_flip(int32_t matrix[9], int hflip, int vflip); - -/** - * @} - * @} - */ - -#endif /* AVUTIL_DISPLAY_H */ diff --git a/media/ffvpx/libavutil/lzo.c b/media/ffvpx/libavutil/lzo.c deleted file mode 100644 index 1ae076e33..000000000 --- a/media/ffvpx/libavutil/lzo.c +++ /dev/null @@ -1,205 +0,0 @@ -/* - * LZO 1x decompression - * Copyright (c) 2006 Reimar Doeffinger - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include <string.h> - -#include "avutil.h" -#include "avassert.h" -#include "common.h" -#include "intreadwrite.h" -#include "lzo.h" - -/// Define if we may write up to 12 bytes beyond the output buffer. -#define OUTBUF_PADDED 1 -/// Define if we may read up to 8 bytes beyond the input buffer. -#define INBUF_PADDED 1 - -typedef struct LZOContext { - const uint8_t *in, *in_end; - uint8_t *out_start, *out, *out_end; - int error; -} LZOContext; - -/** - * @brief Reads one byte from the input buffer, avoiding an overrun. - * @return byte read - */ -static inline int get_byte(LZOContext *c) -{ - if (c->in < c->in_end) - return *c->in++; - c->error |= AV_LZO_INPUT_DEPLETED; - return 1; -} - -#ifdef INBUF_PADDED -#define GETB(c) (*(c).in++) -#else -#define GETB(c) get_byte(&(c)) -#endif - -/** - * @brief Decodes a length value in the coding used by lzo. - * @param x previous byte value - * @param mask bits used from x - * @return decoded length value - */ -static inline int get_len(LZOContext *c, int x, int mask) -{ - int cnt = x & mask; - if (!cnt) { - while (!(x = get_byte(c))) { - if (cnt >= INT_MAX - 1000) { - c->error |= AV_LZO_ERROR; - break; - } - cnt += 255; - } - cnt += mask + x; - } - return cnt; -} - -/** - * @brief Copies bytes from input to output buffer with checking. - * @param cnt number of bytes to copy, must be >= 0 - */ -static inline void copy(LZOContext *c, int cnt) -{ - register const uint8_t *src = c->in; - register uint8_t *dst = c->out; - av_assert0(cnt >= 0); - if (cnt > c->in_end - src) { - cnt = FFMAX(c->in_end - src, 0); - c->error |= AV_LZO_INPUT_DEPLETED; - } - if (cnt > c->out_end - dst) { - cnt = FFMAX(c->out_end - dst, 0); - c->error |= AV_LZO_OUTPUT_FULL; - } -#if defined(INBUF_PADDED) && defined(OUTBUF_PADDED) - AV_COPY32U(dst, src); - src += 4; - dst += 4; - cnt -= 4; - if (cnt > 0) -#endif - memcpy(dst, src, cnt); - c->in = src + cnt; - c->out = dst + cnt; -} - -/** - * @brief Copies previously decoded bytes to current position. - * @param back how many bytes back we start, must be > 0 - * @param cnt number of bytes to copy, must be > 0 - * - * cnt > back is valid, this will copy the bytes we just copied, - * thus creating a repeating pattern with a period length of back. - */ -static inline void copy_backptr(LZOContext *c, int back, int cnt) -{ - register uint8_t *dst = c->out; - av_assert0(cnt > 0); - if (dst - c->out_start < back) { - c->error |= AV_LZO_INVALID_BACKPTR; - return; - } - if (cnt > c->out_end - dst) { - cnt = FFMAX(c->out_end - dst, 0); - c->error |= AV_LZO_OUTPUT_FULL; - } - av_memcpy_backptr(dst, back, cnt); - c->out = dst + cnt; -} - -int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen) -{ - int state = 0; - int x; - LZOContext c; - if (*outlen <= 0 || *inlen <= 0) { - int res = 0; - if (*outlen <= 0) - res |= AV_LZO_OUTPUT_FULL; - if (*inlen <= 0) - res |= AV_LZO_INPUT_DEPLETED; - return res; - } - c.in = in; - c.in_end = (const uint8_t *)in + *inlen; - c.out = c.out_start = out; - c.out_end = (uint8_t *)out + *outlen; - c.error = 0; - x = GETB(c); - if (x > 17) { - copy(&c, x - 17); - x = GETB(c); - if (x < 16) - c.error |= AV_LZO_ERROR; - } - if (c.in > c.in_end) - c.error |= AV_LZO_INPUT_DEPLETED; - while (!c.error) { - int cnt, back; - if (x > 15) { - if (x > 63) { - cnt = (x >> 5) - 1; - back = (GETB(c) << 3) + ((x >> 2) & 7) + 1; - } else if (x > 31) { - cnt = get_len(&c, x, 31); - x = GETB(c); - back = (GETB(c) << 6) + (x >> 2) + 1; - } else { - cnt = get_len(&c, x, 7); - back = (1 << 14) + ((x & 8) << 11); - x = GETB(c); - back += (GETB(c) << 6) + (x >> 2); - if (back == (1 << 14)) { - if (cnt != 1) - c.error |= AV_LZO_ERROR; - break; - } - } - } else if (!state) { - cnt = get_len(&c, x, 15); - copy(&c, cnt + 3); - x = GETB(c); - if (x > 15) - continue; - cnt = 1; - back = (1 << 11) + (GETB(c) << 2) + (x >> 2) + 1; - } else { - cnt = 0; - back = (GETB(c) << 2) + (x >> 2) + 1; - } - copy_backptr(&c, back, cnt + 2); - state = - cnt = x & 3; - copy(&c, cnt); - x = GETB(c); - } - *inlen = c.in_end - c.in; - if (c.in > c.in_end) - *inlen = 0; - *outlen = c.out_end - c.out; - return c.error; -} diff --git a/media/ffvpx/libavutil/lzo.h b/media/ffvpx/libavutil/lzo.h deleted file mode 100644 index c03403992..000000000 --- a/media/ffvpx/libavutil/lzo.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * LZO 1x decompression - * copyright (c) 2006 Reimar Doeffinger - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_LZO_H -#define AVUTIL_LZO_H - -/** - * @defgroup lavu_lzo LZO - * @ingroup lavu_crypto - * - * @{ - */ - -#include <stdint.h> - -/** @name Error flags returned by av_lzo1x_decode - * @{ */ -/// end of the input buffer reached before decoding finished -#define AV_LZO_INPUT_DEPLETED 1 -/// decoded data did not fit into output buffer -#define AV_LZO_OUTPUT_FULL 2 -/// a reference to previously decoded data was wrong -#define AV_LZO_INVALID_BACKPTR 4 -/// a non-specific error in the compressed bitstream -#define AV_LZO_ERROR 8 -/** @} */ - -#define AV_LZO_INPUT_PADDING 8 -#define AV_LZO_OUTPUT_PADDING 12 - -/** - * @brief Decodes LZO 1x compressed data. - * @param out output buffer - * @param outlen size of output buffer, number of bytes left are returned here - * @param in input buffer - * @param inlen size of input buffer, number of bytes left are returned here - * @return 0 on success, otherwise a combination of the error flags above - * - * Make sure all buffers are appropriately padded, in must provide - * AV_LZO_INPUT_PADDING, out must provide AV_LZO_OUTPUT_PADDING additional bytes. - */ -int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen); - -/** - * @} - */ - -#endif /* AVUTIL_LZO_H */ diff --git a/media/ffvpx/libavutil/motion_vector.h b/media/ffvpx/libavutil/motion_vector.h deleted file mode 100644 index ec2955638..000000000 --- a/media/ffvpx/libavutil/motion_vector.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_MOTION_VECTOR_H -#define AVUTIL_MOTION_VECTOR_H - -#include <stdint.h> - -typedef struct AVMotionVector { - /** - * Where the current macroblock comes from; negative value when it comes - * from the past, positive value when it comes from the future. - * XXX: set exact relative ref frame reference instead of a +/- 1 "direction". - */ - int32_t source; - /** - * Width and height of the block. - */ - uint8_t w, h; - /** - * Absolute source position. Can be outside the frame area. - */ - int16_t src_x, src_y; - /** - * Absolute destination position. Can be outside the frame area. - */ - int16_t dst_x, dst_y; - /** - * Extra flag information. - * Currently unused. - */ - uint64_t flags; - /** - * Motion vector - * src_x = dst_x + motion_x / motion_scale - * src_y = dst_y + motion_y / motion_scale - */ - int32_t motion_x, motion_y; - uint16_t motion_scale; -} AVMotionVector; - -#endif /* AVUTIL_MOTION_VECTOR_H */ diff --git a/media/ffvpx/libavutil/moz.build b/media/ffvpx/libavutil/moz.build index 84433ad6e..201b62fed 100644 --- a/media/ffvpx/libavutil/moz.build +++ b/media/ffvpx/libavutil/moz.build @@ -22,7 +22,6 @@ SOURCES += [ 'cpu.c', 'crc.c', 'dict.c', - 'display.c', 'dummy_funcs.c', 'error.c', 'eval.c', diff --git a/media/ffvpx/libavutil/wchar_filename.h b/media/ffvpx/libavutil/wchar_filename.h deleted file mode 100644 index 2ade321be..000000000 --- a/media/ffvpx/libavutil/wchar_filename.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_WCHAR_FILENAME_H -#define AVUTIL_WCHAR_FILENAME_H - -#if defined(_WIN32) && !defined(__MINGW32CE__) -#include <windows.h> -#include "mem.h" - -av_warn_unused_result -static inline int utf8towchar(const char *filename_utf8, wchar_t **filename_w) -{ - int num_chars; - num_chars = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, filename_utf8, -1, NULL, 0); - if (num_chars <= 0) { - *filename_w = NULL; - return 0; - } - *filename_w = (wchar_t *)av_mallocz_array(num_chars, sizeof(wchar_t)); - if (!*filename_w) { - errno = ENOMEM; - return -1; - } - MultiByteToWideChar(CP_UTF8, 0, filename_utf8, -1, *filename_w, num_chars); - return 0; -} -#endif - -#endif /* AVUTIL_WCHAR_FILENAME_H */ |