Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXhmikosR <xhmikosr@users.sourceforge.net>2012-06-12 01:15:14 +0400
committerXhmikosR <xhmikosr@users.sourceforge.net>2012-06-12 01:15:14 +0400
commit5ce73c84a8f6c519aa5303dde4d575e885e645e1 (patch)
tree8ffee81103dc767bf6a234d99d8e590d4cf94a14
parent3b2d04f5a931dd3f9a32baee3480a8438b8868ea (diff)
update ffmpeg (94d5650)
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@5095 10f7b99b-c216-0410-bff0-8a66a9350fd8
-rw-r--r--docs/Changelog.txt2
-rw-r--r--docs/Readme.txt6
-rw-r--r--docs/Todo.txt4
-rw-r--r--src/thirdparty/ffmpeg/Makefile1
-rw-r--r--src/thirdparty/ffmpeg/config.asm1
-rw-r--r--src/thirdparty/ffmpeg/config.h1
-rw-r--r--src/thirdparty/ffmpeg/libavcodec/acelp_filters.c9
-rw-r--r--src/thirdparty/ffmpeg/libavcodec/acelp_filters.h33
-rw-r--r--src/thirdparty/ffmpeg/libavcodec/acelp_vectors.c8
-rw-r--r--src/thirdparty/ffmpeg/libavcodec/acelp_vectors.h24
-rw-r--r--src/thirdparty/ffmpeg/libavcodec/amrnbdec.c57
-rw-r--r--src/thirdparty/ffmpeg/libavcodec/amrwbdec.c60
-rw-r--r--src/thirdparty/ffmpeg/libavcodec/celp_filters.c9
-rw-r--r--src/thirdparty/ffmpeg/libavcodec/celp_filters.h49
-rw-r--r--src/thirdparty/ffmpeg/libavcodec/celp_math.c8
-rw-r--r--src/thirdparty/ffmpeg/libavcodec/celp_math.h19
-rw-r--r--src/thirdparty/ffmpeg/libavcodec/h264.c18
-rw-r--r--src/thirdparty/ffmpeg/libavcodec/indeo4.c10
-rw-r--r--src/thirdparty/ffmpeg/libavcodec/lsp.c6
-rw-r--r--src/thirdparty/ffmpeg/libavcodec/x86/h264dsp_mmx.c2
-rw-r--r--src/thirdparty/ffmpeg/libavcodec/x86/rv40dsp_init.c4
-rw-r--r--src/thirdparty/ffmpeg/libavutil/audioconvert.c41
-rw-r--r--src/thirdparty/ffmpeg/libavutil/audioconvert.h24
-rw-r--r--src/thirdparty/ffmpeg/libavutil/avutil.h2
-rw-r--r--src/thirdparty/ffmpeg/libavutil/bprint.c14
-rw-r--r--src/thirdparty/ffmpeg/libavutil/float_dsp.c11
-rw-r--r--src/thirdparty/ffmpeg/libavutil/libm.h4
-rw-r--r--src/thirdparty/ffmpeg/libavutil/random_seed.c59
-rw-r--r--src/thirdparty/ffmpeg/libavutil/sha.c378
-rw-r--r--src/thirdparty/ffmpeg/libavutil/sha.h66
-rw-r--r--src/thirdparty/ffmpeg/libavutil/x86/float_dsp.asm10
-rw-r--r--src/thirdparty/ffmpeg/libswscale/rgb2rgb.c19
-rw-r--r--src/thirdparty/ffmpeg/libswscale/rgb2rgb.h2
-rw-r--r--src/thirdparty/ffmpeg/libswscale/swscale_unscaled.c16
34 files changed, 881 insertions, 96 deletions
diff --git a/docs/Changelog.txt b/docs/Changelog.txt
index b679adc46..cf8fe47a2 100644
--- a/docs/Changelog.txt
+++ b/docs/Changelog.txt
@@ -18,7 +18,7 @@ Legend:
* Updated unrar.dll to v4.20b3
* Updated MediaInfoLib to v0.7.58
* Updated ZenLib to v0.4.27
-* Updated FFmpeg (git 6fef82f)
+* Updated FFmpeg (git 94d5650)
* Updated Czech, Russian, Ukrainian, Basque and Polish translations
* Ticket #2227, Hide the seek bar in capture mode
* Ticket #2342, MPC-HC will now use the Windows theme font for the Statusbar, OSD messages
diff --git a/docs/Readme.txt b/docs/Readme.txt
index f1e5a5ae1..11078121c 100644
--- a/docs/Readme.txt
+++ b/docs/Readme.txt
@@ -65,7 +65,7 @@ CFileVersionInfo - 19 Jun '02 (modified) http://w
CLineNumberEdit - 12 May '04 (modified) http://www.codeproject.com/Articles/6385/Controls-in-controls-A-line-numbering-edit-box
CSizingControlBar GPLv2 2.45 http://www.datamekanix.com/sizecbar/
Detours MSR-SSLA 3.0 build 316 http://research.microsoft.com/en-us/projects/detours/
-FFmpeg GPLv2 72261fa git http://www.ffmpeg.org/
+FFmpeg GPLv2 66531c7 git http://www.ffmpeg.org/
liba52 GPLv2 0.7.4 cvs http://liba52.sourceforge.net/
libdca GPLv2 0.0.5 r90 http://www.videolan.org/developers/libdca.html
libflac GPLv2 / New BSD License 1.2.1 http://flac.sourceforge.net/
@@ -73,7 +73,7 @@ libmpeg2 GPLv2 0.3.2 (modified) http://l
libogg New BSD License 1.3.0 http://www.xiph.org/
Little CMS MIT License v2.4 git 9e246ec http://www.littlecms.com/
Logitech SDK - 2.02.101 -
-MediaInfoLib LGPLv3 0.7.57 http://mediainfo.sourceforge.net/
+MediaInfoLib LGPLv3 0.7.58 http://mediainfo.sourceforge.net/
MultiMon CPOL 28 Aug '03 (modified) http://www.codeproject.com/KB/GDI/multimon.aspx
QuickTime SDK - 7.3 http://developer.apple.com/quicktime/download/
RealMedia SDK - - -
@@ -82,5 +82,5 @@ SoundTouch LGPLv2.1 1.7.0pre r142 http://w
TreePropSheet - 7 Mar '03 (modified) http://www.codeproject.com/Articles/3709/CTreePropSheet-A-Netscape-Visual-Studio-NET-like-P
UnRAR.dll freeware 4.20b3 http://www.rarlab.com/rar_add.htm
VirtualDub GPLv2 1.10.2-test9 http://www.virtualdub.org/
-ZenLib Simplified BSD License 0.4.26 http://sourceforge.net/projects/zenlib/
+ZenLib Simplified BSD License 0.4.27 http://sourceforge.net/projects/zenlib/
zlib zlib License 1.2.7 http://zlib.net/
diff --git a/docs/Todo.txt b/docs/Todo.txt
index 984f7b188..ff6e74ef0 100644
--- a/docs/Todo.txt
+++ b/docs/Todo.txt
@@ -4,8 +4,8 @@ MPC-HC:
1) Try to fix all /W3 warnings for Win32 in our code.
A search for "#pragma warning" will reveal any places where warnings are disabled,
which shouldn't be a lot in our code. (C4731, C4799 etc)
-2) Run /analyze and fix some of the errors; memory leaks, NULL pointer dereferencing, buffer overrun etc
- http://pastebin.com/TX40Apkw
+2) Run /analyze and fix some of the errors; memory leaks, NULL pointer dereferencing, buffer overruns etc
+ See http://pastebin.com/TX40Apkw
3) Try to clean up the includes; there are a lot of unneeded includes, or includes which are
inherited from files they shouldn't be and are not included directly in the files that need them
4) Try to speed up compilation by doing the above and also by optimizing the included headers
diff --git a/src/thirdparty/ffmpeg/Makefile b/src/thirdparty/ffmpeg/Makefile
index 9a70e0559..40a84a108 100644
--- a/src/thirdparty/ffmpeg/Makefile
+++ b/src/thirdparty/ffmpeg/Makefile
@@ -274,6 +274,7 @@ SRCS_C = \
libavutil/random_seed.c \
libavutil/rational.c \
libavutil/samplefmt.c \
+ libavutil/sha.c \
libavutil/timecode.c \
libavutil/utils.c \
libavutil/x86/cpu.c \
diff --git a/src/thirdparty/ffmpeg/config.asm b/src/thirdparty/ffmpeg/config.asm
index 3f7b7c42e..565db1dc7 100644
--- a/src/thirdparty/ffmpeg/config.asm
+++ b/src/thirdparty/ffmpeg/config.asm
@@ -105,6 +105,7 @@ else
%define HAVE_MALLOC_H 1
%define HAVE_MAPVIEWOFFILE 1
%define HAVE_MEMALIGN 0
+%define HAVE_MIPSFPU 0
%define HAVE_MKSTEMP 0
%define HAVE_MMAP 0
%define HAVE_MMI 0
diff --git a/src/thirdparty/ffmpeg/config.h b/src/thirdparty/ffmpeg/config.h
index 2d3518711..2d9aafc00 100644
--- a/src/thirdparty/ffmpeg/config.h
+++ b/src/thirdparty/ffmpeg/config.h
@@ -89,6 +89,7 @@
#define HAVE_ARMV6 0
#define HAVE_ARMV6T2 0
#define HAVE_ARMVFP 0
+#define HAVE_MIPSFPU 0
#define HAVE_MMI 0
#define HAVE_NEON 0
#define HAVE_PPC4XX 0
diff --git a/src/thirdparty/ffmpeg/libavcodec/acelp_filters.c b/src/thirdparty/ffmpeg/libavcodec/acelp_filters.c
index dff392646..81884515a 100644
--- a/src/thirdparty/ffmpeg/libavcodec/acelp_filters.c
+++ b/src/thirdparty/ffmpeg/libavcodec/acelp_filters.c
@@ -142,3 +142,12 @@ void ff_tilt_compensation(float *mem, float tilt, float *samples, int size)
samples[0] -= tilt * *mem;
*mem = new_tilt_mem;
}
+
+void ff_acelp_filter_init(ACELPFContext *c)
+{
+ c->acelp_interpolatef = ff_acelp_interpolatef;
+ c->acelp_apply_order_2_transfer_function = ff_acelp_apply_order_2_transfer_function;
+
+ if(HAVE_MIPSFPU)
+ ff_acelp_filter_init_mips(c);
+}
diff --git a/src/thirdparty/ffmpeg/libavcodec/acelp_filters.h b/src/thirdparty/ffmpeg/libavcodec/acelp_filters.h
index 83f50504d..c3e9570d0 100644
--- a/src/thirdparty/ffmpeg/libavcodec/acelp_filters.h
+++ b/src/thirdparty/ffmpeg/libavcodec/acelp_filters.h
@@ -25,6 +25,39 @@
#include <stdint.h>
+typedef struct ACELPFContext {
+ /**
+ * Floating point version of ff_acelp_interpolate()
+ */
+ void (*acelp_interpolatef)(float *out, const float *in,
+ const float *filter_coeffs, int precision,
+ int frac_pos, int filter_length, int length);
+
+ /**
+ * Apply an order 2 rational transfer function in-place.
+ *
+ * @param out output buffer for filtered speech samples
+ * @param in input buffer containing speech data (may be the same as out)
+ * @param zero_coeffs z^-1 and z^-2 coefficients of the numerator
+ * @param pole_coeffs z^-1 and z^-2 coefficients of the denominator
+ * @param gain scale factor for final output
+ * @param mem intermediate values used by filter (should be 0 initially)
+ * @param n number of samples (should be a multiple of eight)
+ */
+ void (*acelp_apply_order_2_transfer_function)(float *out, const float *in,
+ const float zero_coeffs[2],
+ const float pole_coeffs[2],
+ float gain,
+ float mem[2], int n);
+
+}ACELPFContext;
+
+/**
+ * Initialize ACELPFContext.
+ */
+void ff_acelp_filter_init(ACELPFContext *c);
+void ff_acelp_filter_init_mips(ACELPFContext *c);
+
/**
* low-pass Finite Impulse Response filter coefficients.
*
diff --git a/src/thirdparty/ffmpeg/libavcodec/acelp_vectors.c b/src/thirdparty/ffmpeg/libavcodec/acelp_vectors.c
index 4c352698d..bd8ed15db 100644
--- a/src/thirdparty/ffmpeg/libavcodec/acelp_vectors.c
+++ b/src/thirdparty/ffmpeg/libavcodec/acelp_vectors.c
@@ -260,3 +260,11 @@ void ff_clear_fixed_vector(float *out, const AMRFixed *in, int size)
} while (x < size && repeats);
}
}
+
+void ff_acelp_vectors_init(ACELPVContext *c)
+{
+ c->weighted_vector_sumf = ff_weighted_vector_sumf;
+
+ if(HAVE_MIPSFPU)
+ ff_acelp_vectors_init_mips(c);
+}
diff --git a/src/thirdparty/ffmpeg/libavcodec/acelp_vectors.h b/src/thirdparty/ffmpeg/libavcodec/acelp_vectors.h
index f0dbc6dba..093d98680 100644
--- a/src/thirdparty/ffmpeg/libavcodec/acelp_vectors.h
+++ b/src/thirdparty/ffmpeg/libavcodec/acelp_vectors.h
@@ -25,6 +25,30 @@
#include <stdint.h>
+typedef struct ACELPVContext {
+ /**
+ * float implementation of weighted sum of two vectors.
+ * @param[out] out result of addition
+ * @param in_a first vector
+ * @param in_b second vector
+ * @param weight_coeff_a first vector weight coefficient
+ * @param weight_coeff_a second vector weight coefficient
+ * @param length vectors length (should be a multiple of two)
+ *
+ * @note It is safe to pass the same buffer for out and in_a or in_b.
+ */
+ void (*weighted_vector_sumf)(float *out, const float *in_a, const float *in_b,
+ float weight_coeff_a, float weight_coeff_b,
+ int length);
+
+}ACELPVContext;
+
+/**
+ * Initialize ACELPVContext.
+ */
+void ff_acelp_vectors_init(ACELPVContext *c);
+void ff_acelp_vectors_init_mips(ACELPVContext *c);
+
/** Sparse representation for the algebraic codebook (fixed) vector */
typedef struct {
int n;
diff --git a/src/thirdparty/ffmpeg/libavcodec/amrnbdec.c b/src/thirdparty/ffmpeg/libavcodec/amrnbdec.c
index 22a0ce13e..674717dc0 100644
--- a/src/thirdparty/ffmpeg/libavcodec/amrnbdec.c
+++ b/src/thirdparty/ffmpeg/libavcodec/amrnbdec.c
@@ -45,6 +45,7 @@
#include "avcodec.h"
#include "libavutil/common.h"
+#include "libavutil/avassert.h"
#include "celp_math.h"
#include "celp_filters.h"
#include "acelp_filters.h"
@@ -135,6 +136,11 @@ typedef struct AMRContext {
float samples_in[LP_FILTER_ORDER + AMR_SUBFRAME_SIZE]; ///< floating point samples
+ ACELPFContext acelpf_ctx; ///< context for filters for ACELP-based codecs
+ ACELPVContext acelpv_ctx; ///< context for vector operations for ACELP-based codecs
+ CELPFContext celpf_ctx; ///< context for filters for CELP-based codecs
+ CELPMContext celpm_ctx; ///< context for fixed point math operations
+
} AMRContext;
/** Double version of ff_weighted_vector_sumf() */
@@ -170,6 +176,11 @@ static av_cold int amrnb_decode_init(AVCodecContext *avctx)
avcodec_get_frame_defaults(&p->avframe);
avctx->coded_frame = &p->avframe;
+ ff_acelp_filter_init(&p->acelpf_ctx);
+ ff_acelp_vectors_init(&p->acelpv_ctx);
+ ff_celp_filter_init(&p->celpf_ctx);
+ ff_celp_math_init(&p->celpm_ctx);
+
return 0;
}
@@ -213,15 +224,16 @@ static enum Mode unpack_bitstream(AMRContext *p, const uint8_t *buf,
* Interpolate the LSF vector (used for fixed gain smoothing).
* The interpolation is done over all four subframes even in MODE_12k2.
*
+ * @param[in] ctx The Context
* @param[in,out] lsf_q LSFs in [0,1] for each subframe
* @param[in] lsf_new New LSFs in [0,1] for subframe 4
*/
-static void interpolate_lsf(float lsf_q[4][LP_FILTER_ORDER], float *lsf_new)
+static void interpolate_lsf(ACELPVContext *ctx, float lsf_q[4][LP_FILTER_ORDER], float *lsf_new)
{
int i;
for (i = 0; i < 4; i++)
- ff_weighted_vector_sumf(lsf_q[i], lsf_q[3], lsf_new,
+ ctx->weighted_vector_sumf(lsf_q[i], lsf_q[3], lsf_new,
0.25 * (3 - i), 0.25 * (i + 1),
LP_FILTER_ORDER);
}
@@ -265,7 +277,7 @@ static void lsf2lsp_for_mode12k2(AMRContext *p, double lsp[LP_FILTER_ORDER],
ff_set_min_dist_lsf(lsf_q, MIN_LSF_SPACING, LP_FILTER_ORDER);
if (update)
- interpolate_lsf(p->lsf_q, lsf_q);
+ interpolate_lsf(&p->acelpv_ctx, p->lsf_q, lsf_q);
ff_acelp_lsf2lspd(lsp, lsf_q, LP_FILTER_ORDER);
}
@@ -328,7 +340,7 @@ static void lsf2lsp_3(AMRContext *p)
ff_set_min_dist_lsf(lsf_q, MIN_LSF_SPACING, LP_FILTER_ORDER);
// store data for computing the next frame's LSFs
- interpolate_lsf(p->lsf_q, lsf_q);
+ interpolate_lsf(&p->acelpv_ctx, p->lsf_q, lsf_q);
memcpy(p->prev_lsf_r, lsf_r, LP_FILTER_ORDER * sizeof(*lsf_r));
ff_acelp_lsf2lspd(p->lsp[3], lsf_q, LP_FILTER_ORDER);
@@ -394,7 +406,8 @@ static void decode_pitch_vector(AMRContext *p,
/* Calculate the pitch vector by interpolating the past excitation at the
pitch lag using a b60 hamming windowed sinc function. */
- ff_acelp_interpolatef(p->excitation, p->excitation + 1 - pitch_lag_int,
+ p->acelpf_ctx.acelp_interpolatef(p->excitation,
+ p->excitation + 1 - pitch_lag_int,
ff_b60_sinc, 6,
pitch_lag_frac + 6 - 6*(pitch_lag_frac > 0),
10, AMR_SUBFRAME_SIZE);
@@ -478,7 +491,7 @@ static void decode_8_pulses_31bits(const int16_t *fixed_index,
static void decode_fixed_sparse(AMRFixed *fixed_sparse, const uint16_t *pulses,
const enum Mode mode, const int subframe)
{
- assert(MODE_4k75 <= mode && mode <= MODE_12k2);
+ av_assert1(MODE_4k75 <= mode && mode <= MODE_12k2);
if (mode == MODE_12k2) {
ff_decode_10_pulses_35bits(pulses, fixed_sparse, gray_decode, 5, 3);
@@ -779,12 +792,12 @@ static int synthesis(AMRContext *p, float *lpc,
for (i = 0; i < AMR_SUBFRAME_SIZE; i++)
p->pitch_vector[i] *= 0.25;
- ff_weighted_vector_sumf(excitation, p->pitch_vector, fixed_vector,
+ p->acelpv_ctx.weighted_vector_sumf(excitation, p->pitch_vector, fixed_vector,
p->pitch_gain[4], fixed_gain, AMR_SUBFRAME_SIZE);
// emphasize pitch vector contribution
if (p->pitch_gain[4] > 0.5 && !overflow) {
- float energy = ff_dot_productf(excitation, excitation,
+ float energy = p->celpm_ctx.dot_productf(excitation, excitation,
AMR_SUBFRAME_SIZE);
float pitch_factor =
p->pitch_gain[4] *
@@ -799,7 +812,8 @@ static int synthesis(AMRContext *p, float *lpc,
AMR_SUBFRAME_SIZE);
}
- ff_celp_lp_synthesis_filterf(samples, lpc, excitation, AMR_SUBFRAME_SIZE,
+ p->celpf_ctx.celp_lp_synthesis_filterf(samples, lpc, excitation,
+ AMR_SUBFRAME_SIZE,
LP_FILTER_ORDER);
// detect overflow
@@ -845,10 +859,11 @@ static void update_state(AMRContext *p)
/**
* Get the tilt factor of a formant filter from its transfer function
*
+ * @param p The Context
* @param lpc_n LP_FILTER_ORDER coefficients of the numerator
* @param lpc_d LP_FILTER_ORDER coefficients of the denominator
*/
-static float tilt_factor(float *lpc_n, float *lpc_d)
+static float tilt_factor(AMRContext *p, float *lpc_n, float *lpc_d)
{
float rh0, rh1; // autocorrelation at lag 0 and 1
@@ -858,11 +873,12 @@ static float tilt_factor(float *lpc_n, float *lpc_d)
hf[0] = 1.0;
memcpy(hf + 1, lpc_n, sizeof(float) * LP_FILTER_ORDER);
- ff_celp_lp_synthesis_filterf(hf, lpc_d, hf, AMR_TILT_RESPONSE,
+ p->celpf_ctx.celp_lp_synthesis_filterf(hf, lpc_d, hf,
+ AMR_TILT_RESPONSE,
LP_FILTER_ORDER);
- rh0 = ff_dot_productf(hf, hf, AMR_TILT_RESPONSE);
- rh1 = ff_dot_productf(hf, hf + 1, AMR_TILT_RESPONSE - 1);
+ rh0 = p->celpm_ctx.dot_productf(hf, hf, AMR_TILT_RESPONSE);
+ rh1 = p->celpm_ctx.dot_productf(hf, hf + 1, AMR_TILT_RESPONSE - 1);
// The spec only specifies this check for 12.2 and 10.2 kbit/s
// modes. But in the ref source the tilt is always non-negative.
@@ -882,7 +898,7 @@ static void postfilter(AMRContext *p, float *lpc, float *buf_out)
int i;
float *samples = p->samples_in + LP_FILTER_ORDER; // Start of input
- float speech_gain = ff_dot_productf(samples, samples,
+ float speech_gain = p->celpm_ctx.dot_productf(samples, samples,
AMR_SUBFRAME_SIZE);
float pole_out[AMR_SUBFRAME_SIZE + LP_FILTER_ORDER]; // Output of pole filter
@@ -903,16 +919,16 @@ static void postfilter(AMRContext *p, float *lpc, float *buf_out)
}
memcpy(pole_out, p->postfilter_mem, sizeof(float) * LP_FILTER_ORDER);
- ff_celp_lp_synthesis_filterf(pole_out + LP_FILTER_ORDER, lpc_d, samples,
+ p->celpf_ctx.celp_lp_synthesis_filterf(pole_out + LP_FILTER_ORDER, lpc_d, samples,
AMR_SUBFRAME_SIZE, LP_FILTER_ORDER);
memcpy(p->postfilter_mem, pole_out + AMR_SUBFRAME_SIZE,
sizeof(float) * LP_FILTER_ORDER);
- ff_celp_lp_zero_synthesis_filterf(buf_out, lpc_n,
+ p->celpf_ctx.celp_lp_zero_synthesis_filterf(buf_out, lpc_n,
pole_out + LP_FILTER_ORDER,
AMR_SUBFRAME_SIZE, LP_FILTER_ORDER);
- ff_tilt_compensation(&p->tilt_mem, tilt_factor(lpc_n, lpc_d), buf_out,
+ ff_tilt_compensation(&p->tilt_mem, tilt_factor(p, lpc_n, lpc_d), buf_out,
AMR_SUBFRAME_SIZE);
ff_adaptive_gain_control(buf_out, buf_out, speech_gain, AMR_SUBFRAME_SIZE,
@@ -989,7 +1005,7 @@ static int amrnb_decode_frame(AVCodecContext *avctx, void *data,
p->fixed_gain[4] =
ff_amr_set_fixed_gain(fixed_gain_factor,
- ff_dot_productf(p->fixed_vector, p->fixed_vector,
+ p->celpm_ctx.dot_productf(p->fixed_vector, p->fixed_vector,
AMR_SUBFRAME_SIZE)/AMR_SUBFRAME_SIZE,
p->prediction_error,
energy_mean[p->cur_frame_mode], energy_pred_fac);
@@ -1033,7 +1049,8 @@ static int amrnb_decode_frame(AVCodecContext *avctx, void *data,
update_state(p);
}
- ff_acelp_apply_order_2_transfer_function(buf_out, buf_out, highpass_zeros,
+ p->acelpf_ctx.acelp_apply_order_2_transfer_function(buf_out,
+ buf_out, highpass_zeros,
highpass_poles,
highpass_gain * AMR_SAMPLE_SCALE,
p->high_pass_mem, AMR_BLOCK_SIZE);
@@ -1044,7 +1061,7 @@ static int amrnb_decode_frame(AVCodecContext *avctx, void *data,
* for fixed_gain_smooth.
* The specification has an incorrect formula: the reference decoder uses
* qbar(n-1) rather than qbar(n) in section 6.1(4) equation 71. */
- ff_weighted_vector_sumf(p->lsf_avg, p->lsf_avg, p->lsf_q[3],
+ p->acelpv_ctx.weighted_vector_sumf(p->lsf_avg, p->lsf_avg, p->lsf_q[3],
0.84, 0.16, LP_FILTER_ORDER);
*got_frame_ptr = 1;
diff --git a/src/thirdparty/ffmpeg/libavcodec/amrwbdec.c b/src/thirdparty/ffmpeg/libavcodec/amrwbdec.c
index 995eb19dc..52c9d6d61 100644
--- a/src/thirdparty/ffmpeg/libavcodec/amrwbdec.c
+++ b/src/thirdparty/ffmpeg/libavcodec/amrwbdec.c
@@ -38,6 +38,9 @@
#include "amr.h"
#include "amrwbdata.h"
+#if HAVE_MIPSFPU // MPC-HC patch
+#include "mips/amrwbdec_mips.h"
+#endif
typedef struct {
AVFrame avframe; ///< AVFrame for decoded samples
@@ -82,6 +85,11 @@ typedef struct {
AVLFG prng; ///< random number generator for white noise excitation
uint8_t first_frame; ///< flag active during decoding of the first frame
+ ACELPFContext acelpf_ctx; ///< context for filters for ACELP-based codecs
+ ACELPVContext acelpv_ctx; ///< context for vector operations for ACELP-based codecs
+ CELPFContext celpf_ctx; ///< context for filters for CELP-based codecs
+ CELPMContext celpm_ctx; ///< context for fixed point math operations
+
} AMRWBContext;
static av_cold int amrwb_decode_init(AVCodecContext *avctx)
@@ -105,6 +113,11 @@ static av_cold int amrwb_decode_init(AVCodecContext *avctx)
avcodec_get_frame_defaults(&ctx->avframe);
avctx->coded_frame = &ctx->avframe;
+ ff_acelp_filter_init(&ctx->acelpf_ctx);
+ ff_acelp_vectors_init(&ctx->acelpv_ctx);
+ ff_celp_filter_init(&ctx->celpf_ctx);
+ ff_celp_math_init(&ctx->celpm_ctx);
+
return 0;
}
@@ -319,7 +332,8 @@ static void decode_pitch_vector(AMRWBContext *ctx,
/* Calculate the pitch vector by interpolating the past excitation at the
pitch lag using a hamming windowed sinc function */
- ff_acelp_interpolatef(exc, exc + 1 - pitch_lag_int,
+ ctx->acelpf_ctx.acelp_interpolatef(exc,
+ exc + 1 - pitch_lag_int,
ac_inter, 4,
pitch_lag_frac + (pitch_lag_frac > 0 ? 0 : 4),
LP_ORDER, AMRWB_SFR_SIZE + 1);
@@ -578,15 +592,17 @@ static void pitch_sharpening(AMRWBContext *ctx, float *fixed_vector)
*
* @param[in] p_vector, f_vector Pitch and fixed excitation vectors
* @param[in] p_gain, f_gain Pitch and fixed gains
+ * @param[in] ctx The context
*/
// XXX: There is something wrong with the precision here! The magnitudes
// of the energies are not correct. Please check the reference code carefully
static float voice_factor(float *p_vector, float p_gain,
- float *f_vector, float f_gain)
+ float *f_vector, float f_gain,
+ CELPMContext *ctx)
{
- double p_ener = (double) ff_dot_productf(p_vector, p_vector,
+ double p_ener = (double) ctx->dot_productf(p_vector, p_vector,
AMRWB_SFR_SIZE) * p_gain * p_gain;
- double f_ener = (double) ff_dot_productf(f_vector, f_vector,
+ double f_ener = (double) ctx->dot_productf(f_vector, f_vector,
AMRWB_SFR_SIZE) * f_gain * f_gain;
return (p_ener - f_ener) / (p_ener + f_ener);
@@ -749,13 +765,13 @@ static void synthesis(AMRWBContext *ctx, float *lpc, float *excitation,
float fixed_gain, const float *fixed_vector,
float *samples)
{
- ff_weighted_vector_sumf(excitation, ctx->pitch_vector, fixed_vector,
+ ctx->acelpv_ctx.weighted_vector_sumf(excitation, ctx->pitch_vector, fixed_vector,
ctx->pitch_gain[0], fixed_gain, AMRWB_SFR_SIZE);
/* emphasize pitch vector contribution in low bitrate modes */
if (ctx->pitch_gain[0] > 0.5 && ctx->fr_cur_mode <= MODE_8k85) {
int i;
- float energy = ff_dot_productf(excitation, excitation,
+ float energy = ctx->celpm_ctx.dot_productf(excitation, excitation,
AMRWB_SFR_SIZE);
// XXX: Weird part in both ref code and spec. A unknown parameter
@@ -769,7 +785,7 @@ static void synthesis(AMRWBContext *ctx, float *lpc, float *excitation,
energy, AMRWB_SFR_SIZE);
}
- ff_celp_lp_synthesis_filterf(samples, lpc, excitation,
+ ctx->celpf_ctx.celp_lp_synthesis_filterf(samples, lpc, excitation,
AMRWB_SFR_SIZE, LP_ORDER);
}
@@ -801,8 +817,9 @@ static void de_emphasis(float *out, float *in, float m, float mem[1])
* @param[out] out Buffer for interpolated signal
* @param[in] in Current signal data (length 0.8*o_size)
* @param[in] o_size Output signal length
+ * @param[in] ctx The context
*/
-static void upsample_5_4(float *out, const float *in, int o_size)
+static void upsample_5_4(float *out, const float *in, int o_size, CELPMContext *ctx)
{
const float *in0 = in - UPS_FIR_SIZE + 1;
int i, j, k;
@@ -815,7 +832,8 @@ static void upsample_5_4(float *out, const float *in, int o_size)
i++;
for (k = 1; k < 5; k++) {
- out[i] = ff_dot_productf(in0 + int_part, upsample_fir[4 - frac_part],
+ out[i] = ctx->dot_productf(in0 + int_part,
+ upsample_fir[4 - frac_part],
UPS_MEM_SIZE);
int_part++;
frac_part--;
@@ -842,8 +860,8 @@ static float find_hb_gain(AMRWBContext *ctx, const float *synth,
if (ctx->fr_cur_mode == MODE_23k85)
return qua_hb_gain[hb_idx] * (1.0f / (1 << 14));
- tilt = ff_dot_productf(synth, synth + 1, AMRWB_SFR_SIZE - 1) /
- ff_dot_productf(synth, synth, AMRWB_SFR_SIZE);
+ tilt = ctx->celpm_ctx.dot_productf(synth, synth + 1, AMRWB_SFR_SIZE - 1) /
+ ctx->celpm_ctx.dot_productf(synth, synth, AMRWB_SFR_SIZE);
/* return gain bounded by [0.1, 1.0] */
return av_clipf((1.0 - FFMAX(0.0, tilt)) * (1.25 - 0.25 * wsp), 0.1, 1.0);
@@ -862,7 +880,7 @@ static void scaled_hb_excitation(AMRWBContext *ctx, float *hb_exc,
const float *synth_exc, float hb_gain)
{
int i;
- float energy = ff_dot_productf(synth_exc, synth_exc, AMRWB_SFR_SIZE);
+ float energy = ctx->celpm_ctx.dot_productf(synth_exc, synth_exc, AMRWB_SFR_SIZE);
/* Generate a white-noise excitation */
for (i = 0; i < AMRWB_SFR_SIZE_16k; i++)
@@ -993,7 +1011,7 @@ static void hb_synthesis(AMRWBContext *ctx, int subframe, float *samples,
float e_isf[LP_ORDER_16k]; // ISF vector for extrapolation
double e_isp[LP_ORDER_16k];
- ff_weighted_vector_sumf(e_isf, isf_past, isf, isfp_inter[subframe],
+ ctx->acelpv_ctx.weighted_vector_sumf(e_isf, isf_past, isf, isfp_inter[subframe],
1.0 - isfp_inter[subframe], LP_ORDER);
extrapolate_isf(e_isf);
@@ -1007,7 +1025,7 @@ static void hb_synthesis(AMRWBContext *ctx, int subframe, float *samples,
lpc_weighting(hb_lpc, ctx->lp_coef[subframe], 0.6, LP_ORDER);
}
- ff_celp_lp_synthesis_filterf(samples, hb_lpc, exc, AMRWB_SFR_SIZE_16k,
+ ctx->celpf_ctx.celp_lp_synthesis_filterf(samples, hb_lpc, exc, AMRWB_SFR_SIZE_16k,
(mode == MODE_6k60) ? LP_ORDER_16k : LP_ORDER);
}
@@ -1022,6 +1040,8 @@ static void hb_synthesis(AMRWBContext *ctx, int subframe, float *samples,
*
* @remark It is safe to pass the same array in in and out parameters
*/
+
+#ifndef hb_fir_filter
static void hb_fir_filter(float *out, const float fir_coef[HB_FIR_SIZE + 1],
float mem[HB_FIR_SIZE], const float *in)
{
@@ -1039,6 +1059,7 @@ static void hb_fir_filter(float *out, const float fir_coef[HB_FIR_SIZE + 1],
memcpy(mem, data + AMRWB_SFR_SIZE_16k, HB_FIR_SIZE * sizeof(float));
}
+#endif /* hb_fir_filter */
/**
* Update context state before the next subframe.
@@ -1155,14 +1176,15 @@ static int amrwb_decode_frame(AVCodecContext *avctx, void *data,
ctx->fixed_gain[0] =
ff_amr_set_fixed_gain(fixed_gain_factor,
- ff_dot_productf(ctx->fixed_vector, ctx->fixed_vector,
+ ctx->celpm_ctx.dot_productf(ctx->fixed_vector, ctx->fixed_vector,
AMRWB_SFR_SIZE) / AMRWB_SFR_SIZE,
ctx->prediction_error,
ENERGY_MEAN, energy_pred_fac);
/* Calculate voice factor and store tilt for next subframe */
voice_fac = voice_factor(ctx->pitch_vector, ctx->pitch_gain[0],
- ctx->fixed_vector, ctx->fixed_gain[0]);
+ ctx->fixed_vector, ctx->fixed_gain[0],
+ &ctx->celpm_ctx);
ctx->tilt_coef = voice_fac * 0.25 + 0.25;
/* Construct current excitation */
@@ -1188,15 +1210,15 @@ static int amrwb_decode_frame(AVCodecContext *avctx, void *data,
de_emphasis(&ctx->samples_up[UPS_MEM_SIZE],
&ctx->samples_az[LP_ORDER], PREEMPH_FAC, ctx->demph_mem);
- ff_acelp_apply_order_2_transfer_function(&ctx->samples_up[UPS_MEM_SIZE],
+ ctx->acelpf_ctx.acelp_apply_order_2_transfer_function(&ctx->samples_up[UPS_MEM_SIZE],
&ctx->samples_up[UPS_MEM_SIZE], hpf_zeros, hpf_31_poles,
hpf_31_gain, ctx->hpf_31_mem, AMRWB_SFR_SIZE);
upsample_5_4(sub_buf, &ctx->samples_up[UPS_FIR_SIZE],
- AMRWB_SFR_SIZE_16k);
+ AMRWB_SFR_SIZE_16k, &ctx->celpm_ctx);
/* High frequency band (6.4 - 7.0 kHz) generation part */
- ff_acelp_apply_order_2_transfer_function(hb_samples,
+ ctx->acelpf_ctx.acelp_apply_order_2_transfer_function(hb_samples,
&ctx->samples_up[UPS_MEM_SIZE], hpf_zeros, hpf_400_poles,
hpf_400_gain, ctx->hpf_400_mem, AMRWB_SFR_SIZE);
diff --git a/src/thirdparty/ffmpeg/libavcodec/celp_filters.c b/src/thirdparty/ffmpeg/libavcodec/celp_filters.c
index c1aa3bc71..d8546301a 100644
--- a/src/thirdparty/ffmpeg/libavcodec/celp_filters.c
+++ b/src/thirdparty/ffmpeg/libavcodec/celp_filters.c
@@ -205,3 +205,12 @@ void ff_celp_lp_zero_synthesis_filterf(float *out, const float *filter_coeffs,
out[n] += filter_coeffs[i-1] * in[n-i];
}
}
+
+void ff_celp_filter_init(CELPFContext *c)
+{
+ c->celp_lp_synthesis_filterf = ff_celp_lp_synthesis_filterf;
+ c->celp_lp_zero_synthesis_filterf = ff_celp_lp_zero_synthesis_filterf;
+
+ if(HAVE_MIPSFPU)
+ ff_celp_filter_init_mips(c);
+}
diff --git a/src/thirdparty/ffmpeg/libavcodec/celp_filters.h b/src/thirdparty/ffmpeg/libavcodec/celp_filters.h
index f9fe3a66f..54cb1e358 100644
--- a/src/thirdparty/ffmpeg/libavcodec/celp_filters.h
+++ b/src/thirdparty/ffmpeg/libavcodec/celp_filters.h
@@ -25,6 +25,55 @@
#include <stdint.h>
+typedef struct CELPFContext {
+ /**
+ * LP synthesis filter.
+ * @param[out] out pointer to output buffer
+ * - the array out[-filter_length, -1] must
+ * contain the previous result of this filter
+ * @param filter_coeffs filter coefficients.
+ * @param in input signal
+ * @param buffer_length amount of data to process
+ * @param filter_length filter length (10 for 10th order LP filter). Must be
+ * greater than 4 and even.
+ *
+ * @note Output buffer must contain filter_length samples of past
+ * speech data before pointer.
+ *
+ * Routine applies 1/A(z) filter to given speech data.
+ */
+ void (*celp_lp_synthesis_filterf)(float *out, const float *filter_coeffs,
+ const float *in, int buffer_length,
+ int filter_length);
+
+ /**
+ * LP zero synthesis filter.
+ * @param[out] out pointer to output buffer
+ * @param filter_coeffs filter coefficients.
+ * @param in input signal
+ * - the array in[-filter_length, -1] must
+ * contain the previous input of this filter
+ * @param buffer_length amount of data to process (should be a multiple of eight)
+ * @param filter_length filter length (10 for 10th order LP filter;
+ * should be a multiple of two)
+ *
+ * @note Output buffer must contain filter_length samples of past
+ * speech data before pointer.
+ *
+ * Routine applies A(z) filter to given speech data.
+ */
+ void (*celp_lp_zero_synthesis_filterf)(float *out, const float *filter_coeffs,
+ const float *in, int buffer_length,
+ int filter_length);
+
+}CELPFContext;
+
+/**
+ * Initialize CELPFContext.
+ */
+void ff_celp_filter_init(CELPFContext *c);
+void ff_celp_filter_init_mips(CELPFContext *c);
+
/**
* Circularly convolve fixed vector with a phase dispersion impulse
* response filter (D.6.2 of G.729 and 6.1.5 of AMR).
diff --git a/src/thirdparty/ffmpeg/libavcodec/celp_math.c b/src/thirdparty/ffmpeg/libavcodec/celp_math.c
index 86f5e80fd..05588d8ba 100644
--- a/src/thirdparty/ffmpeg/libavcodec/celp_math.c
+++ b/src/thirdparty/ffmpeg/libavcodec/celp_math.c
@@ -218,3 +218,11 @@ float ff_dot_productf(const float* a, const float* b, int length)
return sum;
}
+
+void ff_celp_math_init(CELPMContext *c)
+{
+ c->dot_productf = ff_dot_productf;
+
+ if(HAVE_MIPSFPU)
+ ff_celp_math_init_mips(c);
+}
diff --git a/src/thirdparty/ffmpeg/libavcodec/celp_math.h b/src/thirdparty/ffmpeg/libavcodec/celp_math.h
index f603868f0..3fcf2ecaf 100644
--- a/src/thirdparty/ffmpeg/libavcodec/celp_math.h
+++ b/src/thirdparty/ffmpeg/libavcodec/celp_math.h
@@ -25,6 +25,25 @@
#include <stdint.h>
+typedef struct CELPMContext {
+ /**
+ * Return the dot product.
+ * @param a input data array
+ * @param b input data array
+ * @param length number of elements
+ *
+ * @return dot product = sum of elementwise products
+ */
+ float (*dot_productf)(const float* a, const float* b, int length);
+
+}CELPMContext;
+
+/**
+ * Initialize CELPMContext.
+ */
+void ff_celp_math_init(CELPMContext *c);
+void ff_celp_math_init_mips(CELPMContext *c);
+
/**
* fixed-point implementation of cosine in [0; PI) domain.
* @param arg fixed-point cosine argument, 0 <= arg < 0x4000
diff --git a/src/thirdparty/ffmpeg/libavcodec/h264.c b/src/thirdparty/ffmpeg/libavcodec/h264.c
index 1d18c3a45..349981b2a 100644
--- a/src/thirdparty/ffmpeg/libavcodec/h264.c
+++ b/src/thirdparty/ffmpeg/libavcodec/h264.c
@@ -2971,7 +2971,6 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
s->width = 16 * s->mb_width;
s->height = 16 * s->mb_height;
-
if(must_reinit) {
free_tables(h, 0);
flush_dpb(s->avctx);
@@ -2985,13 +2984,24 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
"Cannot (re-)initialize context during parallel decoding.\n");
return -1;
}
- avcodec_set_dimensions(s->avctx, s->width, s->height);
- s->avctx->width -= (2>>CHROMA444)*FFMIN(h->sps.crop_right, (8<<CHROMA444)-1);
- s->avctx->height -= (1<<s->chroma_y_shift)*FFMIN(h->sps.crop_bottom, (16>>s->chroma_y_shift)-1) * (2 - h->sps.frame_mbs_only_flag);
+ if( FFALIGN(s->avctx->width , 16 ) == s->width
+ && FFALIGN(s->avctx->height, 16*(2 - h->sps.frame_mbs_only_flag)) == s->height
+ && !h->sps.crop_right && !h->sps.crop_bottom
+ && (s->avctx->width != s->width || s->avctx->height && s->height)
+ ) {
+ av_log(h->s.avctx, AV_LOG_DEBUG, "Using externally provided dimensions\n");
+ s->avctx->coded_width = s->width;
+ s->avctx->coded_height = s->height;
+ } else{
+ avcodec_set_dimensions(s->avctx, s->width, s->height);
+ s->avctx->width -= (2>>CHROMA444)*FFMIN(h->sps.crop_right, (8<<CHROMA444)-1);
+ s->avctx->height -= (1<<s->chroma_y_shift)*FFMIN(h->sps.crop_bottom, (16>>s->chroma_y_shift)-1) * (2 - h->sps.frame_mbs_only_flag);
+ }
// ==> Start patch MPC
//s->avctx->sample_aspect_ratio = h->sps.sar;
//av_assert0(s->avctx->sample_aspect_ratio.den);
// ==> End patch MPC
+
if (s->avctx->bits_per_raw_sample != h->sps.bit_depth_luma ||
h->cur_chroma_format_idc != h->sps.chroma_format_idc) {
if (h->sps.bit_depth_luma >= 8 && h->sps.bit_depth_luma <= 10 &&
diff --git a/src/thirdparty/ffmpeg/libavcodec/indeo4.c b/src/thirdparty/ffmpeg/libavcodec/indeo4.c
index b51ac46fc..32bdb6d28 100644
--- a/src/thirdparty/ffmpeg/libavcodec/indeo4.c
+++ b/src/thirdparty/ffmpeg/libavcodec/indeo4.c
@@ -40,7 +40,7 @@
*/
enum {
FRAMETYPE_INTRA = 0,
- FRAMETYPE_BIDIR1 = 1, ///< bidirectional frame
+ FRAMETYPE_INTRA1 = 1, ///< intra frame with slightly different bitstream coding
FRAMETYPE_INTER = 2, ///< non-droppable P-frame
FRAMETYPE_BIDIR = 3, ///< bidirectional frame
FRAMETYPE_INTER_NOREF = 4, ///< droppable P-frame
@@ -133,8 +133,7 @@ static int decode_pic_hdr(IVI45DecContext *ctx, AVCodecContext *avctx)
}
#if IVI4_STREAM_ANALYSER
- if ( ctx->frame_type == FRAMETYPE_BIDIR1
- || ctx->frame_type == FRAMETYPE_BIDIR)
+ if (ctx->frame_type == FRAMETYPE_BIDIR)
ctx->has_b_frames = 1;
#endif
@@ -500,7 +499,8 @@ static int decode_mb_info(IVI45DecContext *ctx, IVIBandDesc *band,
} else {
if (band->inherit_mv && ref_mb) {
mb->type = ref_mb->type; /* copy mb_type from corresponding reference mb */
- } else if (ctx->frame_type == FRAMETYPE_INTRA) {
+ } else if (ctx->frame_type == FRAMETYPE_INTRA ||
+ ctx->frame_type == FRAMETYPE_INTRA1) {
mb->type = 0; /* mb_type is always INTRA for intra-frames */
} else {
mb->type = get_bits(&ctx->gb, mb_type_bits);
@@ -577,6 +577,7 @@ static void switch_buffers(IVI45DecContext *ctx)
{
switch (ctx->prev_frame_type) {
case FRAMETYPE_INTRA:
+ case FRAMETYPE_INTRA1:
case FRAMETYPE_INTER:
ctx->buf_switch ^= 1;
ctx->dst_buf = ctx->buf_switch;
@@ -588,6 +589,7 @@ static void switch_buffers(IVI45DecContext *ctx)
switch (ctx->frame_type) {
case FRAMETYPE_INTRA:
+ case FRAMETYPE_INTRA1:
ctx->buf_switch = 0;
/* FALLTHROUGH */
case FRAMETYPE_INTER:
diff --git a/src/thirdparty/ffmpeg/libavcodec/lsp.c b/src/thirdparty/ffmpeg/libavcodec/lsp.c
index 0e3191d17..7a376dff7 100644
--- a/src/thirdparty/ffmpeg/libavcodec/lsp.c
+++ b/src/thirdparty/ffmpeg/libavcodec/lsp.c
@@ -28,6 +28,10 @@
#include "mathops.h"
#include "lsp.h"
#include "celp_math.h"
+#if HAVE_MIPSFPU // MPC-HC patch
+#include "libavcodec/mips/lsp_mips.h"
+#endif
+
void ff_acelp_reorder_lsf(int16_t* lsfq, int lsfq_min_distance, int lsfq_min, int lsfq_max, int lp_order)
{
@@ -162,6 +166,7 @@ void ff_acelp_lp_decode(int16_t* lp_1st, int16_t* lp_2nd, const int16_t* lsp_2nd
ff_acelp_lsp2lpc(lp_2nd, lsp_2nd, lp_order >> 1);
}
+#ifndef ff_lsp2polyf
void ff_lsp2polyf(const double *lsp, double *f, int lp_half_order)
{
int i, j;
@@ -178,6 +183,7 @@ void ff_lsp2polyf(const double *lsp, double *f, int lp_half_order)
f[1] += val;
}
}
+#endif /* ff_lsp2polyf */
void ff_acelp_lspd2lpc(const double *lsp, float *lpc, int lp_half_order)
{
diff --git a/src/thirdparty/ffmpeg/libavcodec/x86/h264dsp_mmx.c b/src/thirdparty/ffmpeg/libavcodec/x86/h264dsp_mmx.c
index f75507176..74b7a4f0a 100644
--- a/src/thirdparty/ffmpeg/libavcodec/x86/h264dsp_mmx.c
+++ b/src/thirdparty/ffmpeg/libavcodec/x86/h264dsp_mmx.c
@@ -275,7 +275,7 @@ LF_IFUNC(v, chroma_intra, depth, avx)
LF_FUNCS( uint8_t, 8)
LF_FUNCS(uint16_t, 10)
-#if ARCH_X86_32
+#if ARCH_X86_32 && HAVE_YASM
LF_FUNC (v8, luma, 8, mmxext)
static void ff_deblock_v_luma_8_mmxext(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0)
{
diff --git a/src/thirdparty/ffmpeg/libavcodec/x86/rv40dsp_init.c b/src/thirdparty/ffmpeg/libavcodec/x86/rv40dsp_init.c
index 1dac77907..825727832 100644
--- a/src/thirdparty/ffmpeg/libavcodec/x86/rv40dsp_init.c
+++ b/src/thirdparty/ffmpeg/libavcodec/x86/rv40dsp_init.c
@@ -56,6 +56,8 @@ DECLARE_WEIGHT(mmx2)
DECLARE_WEIGHT(sse2)
DECLARE_WEIGHT(ssse3)
+#if HAVE_YASM
+
/** @{ */
/**
* Define one qpel function.
@@ -182,6 +184,8 @@ QPEL_FUNCS_SET (OP, 3, 1, OPT) \
QPEL_FUNCS_SET (OP, 3, 2, OPT)
/** @} */
+#endif //HAVE_YASM
+
void ff_rv40dsp_init_x86(RV34DSPContext *c, DSPContext *dsp)
{
#if HAVE_YASM
diff --git a/src/thirdparty/ffmpeg/libavutil/audioconvert.c b/src/thirdparty/ffmpeg/libavutil/audioconvert.c
index c8cc74b64..88214c57f 100644
--- a/src/thirdparty/ffmpeg/libavutil/audioconvert.c
+++ b/src/thirdparty/ffmpeg/libavutil/audioconvert.c
@@ -182,11 +182,7 @@ void av_get_channel_layout_string(char *buf, int buf_size,
int av_get_channel_layout_nb_channels(uint64_t channel_layout)
{
- int count;
- uint64_t x = channel_layout;
- for (count = 0; x; count++)
- x &= x-1; // unset lowest set bit
- return count;
+ return av_popcount64(channel_layout);
}
int64_t av_get_default_channel_layout(int nb_channels) {
@@ -196,3 +192,38 @@ int64_t av_get_default_channel_layout(int nb_channels) {
return channel_layout_map[i].layout;
return 0;
}
+
+int av_get_channel_layout_channel_index(uint64_t channel_layout,
+ uint64_t channel)
+{
+ if (!(channel_layout & channel) ||
+ av_get_channel_layout_nb_channels(channel) != 1)
+ return AVERROR(EINVAL);
+ channel_layout &= channel - 1;
+ return av_get_channel_layout_nb_channels(channel_layout);
+}
+
+const char *av_get_channel_name(uint64_t channel)
+{
+ int i;
+ if (av_get_channel_layout_nb_channels(channel) != 1)
+ return NULL;
+ for (i = 0; i < 64; i++)
+ if ((1ULL<<i) & channel)
+ return get_channel_name(i);
+ return NULL;
+}
+
+uint64_t av_channel_layout_extract_channel(uint64_t channel_layout, int index)
+{
+ int i;
+
+ if (av_get_channel_layout_nb_channels(channel_layout) <= index)
+ return 0;
+
+ for (i = 0; i < 64; i++) {
+ if ((1ULL << i) & channel_layout && !index--)
+ return 1ULL << i;
+ }
+ return 0;
+}
diff --git a/src/thirdparty/ffmpeg/libavutil/audioconvert.h b/src/thirdparty/ffmpeg/libavutil/audioconvert.h
index a77e67039..7afe0552d 100644
--- a/src/thirdparty/ffmpeg/libavutil/audioconvert.h
+++ b/src/thirdparty/ffmpeg/libavutil/audioconvert.h
@@ -150,6 +150,30 @@ int av_get_channel_layout_nb_channels(uint64_t channel_layout);
int64_t av_get_default_channel_layout(int nb_channels);
/**
+ * Get the index of a channel in channel_layout.
+ *
+ * @param channel a channel layout describing exactly one channel which must be
+ * present in channel_layout.
+ *
+ * @return index of channel in channel_layout on success, a negative AVERROR
+ * on error.
+ */
+int av_get_channel_layout_channel_index(uint64_t channel_layout,
+ uint64_t channel);
+
+/**
+ * Get the channel with the given index in channel_layout.
+ */
+uint64_t av_channel_layout_extract_channel(uint64_t channel_layout, int index);
+
+/**
+ * Get the name of a given channel.
+ *
+ * @return channel name on success, NULL on error.
+ */
+const char *av_get_channel_name(uint64_t channel);
+
+/**
* @}
*/
diff --git a/src/thirdparty/ffmpeg/libavutil/avutil.h b/src/thirdparty/ffmpeg/libavutil/avutil.h
index 0347c1982..c278cf7ff 100644
--- a/src/thirdparty/ffmpeg/libavutil/avutil.h
+++ b/src/thirdparty/ffmpeg/libavutil/avutil.h
@@ -153,7 +153,7 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 51
-#define LIBAVUTIL_VERSION_MINOR 56
+#define LIBAVUTIL_VERSION_MINOR 57
#define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
diff --git a/src/thirdparty/ffmpeg/libavutil/bprint.c b/src/thirdparty/ffmpeg/libavutil/bprint.c
index 8cc7dc1be..81e6866bb 100644
--- a/src/thirdparty/ffmpeg/libavutil/bprint.c
+++ b/src/thirdparty/ffmpeg/libavutil/bprint.c
@@ -191,36 +191,36 @@ int main(void)
av_bprint_init(&b, 0, -1);
bprint_pascal(&b, 5);
- printf("Short text in unlimited buffer: %zu/%u\n", strlen(b.str), b.len);
+ printf("Short text in unlimited buffer: %u/%u\n", (unsigned)strlen(b.str), b.len);
printf("%s\n", b.str);
av_bprint_finalize(&b, NULL);
av_bprint_init(&b, 0, -1);
bprint_pascal(&b, 25);
- printf("Long text in unlimited buffer: %zu/%u\n", strlen(b.str), b.len);
+ printf("Long text in unlimited buffer: %u/%u\n", (unsigned)strlen(b.str), b.len);
av_bprint_finalize(&b, NULL);
av_bprint_init(&b, 0, 2048);
bprint_pascal(&b, 25);
- printf("Long text in limited buffer: %zu/%u\n", strlen(b.str), b.len);
+ printf("Long text in limited buffer: %u/%u\n", (unsigned)strlen(b.str), b.len);
av_bprint_finalize(&b, NULL);
av_bprint_init(&b, 0, 1);
bprint_pascal(&b, 5);
- printf("Short text in automatic buffer: %zu/%u\n", strlen(b.str), b.len);
+ printf("Short text in automatic buffer: %u/%u\n", (unsigned)strlen(b.str), b.len);
av_bprint_init(&b, 0, 1);
bprint_pascal(&b, 25);
- printf("Long text in automatic buffer: %zu/%u\n", strlen(b.str)/8*8, b.len);
+ printf("Long text in automatic buffer: %u/%u\n", (unsigned)strlen(b.str)/8*8, b.len);
/* Note that the size of the automatic buffer is arch-dependant. */
av_bprint_init(&b, 0, 0);
bprint_pascal(&b, 25);
- printf("Long text count only buffer: %zu/%u\n", strlen(b.str), b.len);
+ printf("Long text count only buffer: %u/%u\n", (unsigned)strlen(b.str), b.len);
av_bprint_init_for_buffer(&b, buf, sizeof(buf));
bprint_pascal(&b, 25);
- printf("Long text count only buffer: %zu/%u\n", strlen(buf), b.len);
+ printf("Long text count only buffer: %u/%u\n", (unsigned)strlen(buf), b.len);
return 0;
}
diff --git a/src/thirdparty/ffmpeg/libavutil/float_dsp.c b/src/thirdparty/ffmpeg/libavutil/float_dsp.c
index 1e56d33d6..52dbc2556 100644
--- a/src/thirdparty/ffmpeg/libavutil/float_dsp.c
+++ b/src/thirdparty/ffmpeg/libavutil/float_dsp.c
@@ -1,18 +1,21 @@
/*
- * This file is part of Libav.
+ * Copyright 2005 Balatoni Denes
+ * Copyright 2006 Loren Merritt
*
- * Libav is free software; you can redistribute it and/or
+ * 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.
*
- * Libav is distributed in the hope that it will be useful,
+ * 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 Libav; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
diff --git a/src/thirdparty/ffmpeg/libavutil/libm.h b/src/thirdparty/ffmpeg/libavutil/libm.h
index a460f3963..5c30e5e59 100644
--- a/src/thirdparty/ffmpeg/libavutil/libm.h
+++ b/src/thirdparty/ffmpeg/libavutil/libm.h
@@ -28,6 +28,10 @@
#include "config.h"
#include "attributes.h"
+#if HAVE_MIPSFPU && HAVE_INLINE_ASM
+#include "libavutil/mips/libm_mips.h"
+#endif /* HAVE_MIPSFPU && HAVE_INLINE_ASM*/
+
#if !HAVE_CBRTF
#undef cbrtf
#define cbrtf(x) powf(x, 1.0/3.0)
diff --git a/src/thirdparty/ffmpeg/libavutil/random_seed.c b/src/thirdparty/ffmpeg/libavutil/random_seed.c
index 0d78670a9..ec80aa5b9 100644
--- a/src/thirdparty/ffmpeg/libavutil/random_seed.c
+++ b/src/thirdparty/ffmpeg/libavutil/random_seed.c
@@ -22,8 +22,15 @@
#include <fcntl.h>
#include <math.h>
#include <time.h>
+#include <string.h>
#include "timer.h"
#include "random_seed.h"
+#include "sha.h"
+#include "intreadwrite.h"
+
+#ifndef TEST
+#define TEST 0
+#endif
static int read_random(uint32_t *dst, const char *file)
{
@@ -40,34 +47,44 @@ static int read_random(uint32_t *dst, const char *file)
static uint32_t get_generic_seed(void)
{
+ uint8_t tmp[av_sha_size];
+ struct AVSHA *sha = (void*)tmp;
clock_t last_t = 0;
- int bits = 0;
- uint64_t random = 0;
- unsigned i;
- float s = 0.000000000001;
+ static uint64_t i = 0;
+ static uint32_t buffer[512] = {0};
+ unsigned char digest[32];
+ uint64_t last_i = i;
- for (i = 0; bits < 64; i++) {
+ if(TEST){
+ memset(buffer, 0, sizeof(buffer));
+ last_i = i = 0;
+ }else{
+#ifdef AV_READ_TIME
+ buffer[13] ^= AV_READ_TIME();
+ buffer[41] ^= AV_READ_TIME()>>32;
+#endif
+ }
+
+ for (;;) {
clock_t t = clock();
- if (last_t && fabs(t - last_t) > s || t == (clock_t) -1) {
- if (i < 10000 && s < (1 << 24)) {
- s += s;
- i = t = 0;
- } else {
- random = 2 * random + (i & 1);
- bits++;
- }
+
+ if(last_t == t){
+ buffer[i&511]++;
+ }else{
+ buffer[++i&511]+= (t-last_t) % 3294638521U;
+ if(last_i && i-last_i > 4 || i-last_i > 64 || TEST && i-last_i > 8)
+ break;
}
last_t = t;
}
-#ifdef AV_READ_TIME
- random ^= AV_READ_TIME();
-#else
- random ^= clock();
-#endif
- random += random >> 32;
+ if(TEST)
+ buffer[0] = buffer[1] = 0;
- return random;
+ av_sha_init(sha, 160);
+ av_sha_update(sha, (uint8_t*)buffer, sizeof(buffer));
+ av_sha_final(sha, digest);
+ return AV_RB32(digest) + AV_RB32(digest+32);
}
uint32_t av_get_random_seed(void)
@@ -81,7 +98,7 @@ uint32_t av_get_random_seed(void)
return get_generic_seed();
}
-#ifdef TEST
+#if TEST
#undef printf
#define N 256
#include <stdio.h>
diff --git a/src/thirdparty/ffmpeg/libavutil/sha.c b/src/thirdparty/ffmpeg/libavutil/sha.c
new file mode 100644
index 000000000..dd80b863f
--- /dev/null
+++ b/src/thirdparty/ffmpeg/libavutil/sha.c
@@ -0,0 +1,378 @@
+/*
+ * Copyright (C) 2007 Michael Niedermayer <michaelni@gmx.at>
+ * Copyright (C) 2009 Konstantin Shishkov
+ * based on public domain SHA-1 code by Steve Reid <steve@edmweb.com>
+ * and on BSD-licensed SHA-2 code by Aaron D. Gifford
+ *
+ * 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 "bswap.h"
+#include "sha.h"
+#include "intreadwrite.h"
+
+/** hash context */
+typedef struct AVSHA {
+ uint8_t digest_len; ///< digest length in 32-bit words
+ uint64_t count; ///< number of bytes in buffer
+ uint8_t buffer[64]; ///< 512-bit buffer of input values used in hash updating
+ uint32_t state[8]; ///< current hash value
+ /** function used to update hash for 512-bit input block */
+ void (*transform)(uint32_t *state, const uint8_t buffer[64]);
+} AVSHA;
+
+const int av_sha_size = sizeof(AVSHA);
+
+#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
+
+/* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */
+#define blk0(i) (block[i] = AV_RB32(buffer + 4 * (i)))
+#define blk(i) (block[i] = rol(block[i-3] ^ block[i-8] ^ block[i-14] ^ block[i-16], 1))
+
+#define R0(v,w,x,y,z,i) z += ((w&(x^y))^y) + blk0(i) + 0x5A827999 + rol(v, 5); w = rol(w, 30);
+#define R1(v,w,x,y,z,i) z += ((w&(x^y))^y) + blk (i) + 0x5A827999 + rol(v, 5); w = rol(w, 30);
+#define R2(v,w,x,y,z,i) z += ( w^x ^y) + blk (i) + 0x6ED9EBA1 + rol(v, 5); w = rol(w, 30);
+#define R3(v,w,x,y,z,i) z += (((w|x)&y)|(w&x)) + blk (i) + 0x8F1BBCDC + rol(v, 5); w = rol(w, 30);
+#define R4(v,w,x,y,z,i) z += ( w^x ^y) + blk (i) + 0xCA62C1D6 + rol(v, 5); w = rol(w, 30);
+
+/* Hash a single 512-bit block. This is the core of the algorithm. */
+
+static void sha1_transform(uint32_t state[5], const uint8_t buffer[64])
+{
+ uint32_t block[80];
+ unsigned int i, a, b, c, d, e;
+
+ a = state[0];
+ b = state[1];
+ c = state[2];
+ d = state[3];
+ e = state[4];
+#if CONFIG_SMALL
+ for (i = 0; i < 80; i++) {
+ int t;
+ if (i < 16)
+ t = AV_RB32(buffer + 4 * i);
+ else
+ t = rol(block[i-3] ^ block[i-8] ^ block[i-14] ^ block[i-16], 1);
+ block[i] = t;
+ t += e + rol(a, 5);
+ if (i < 40) {
+ if (i < 20)
+ t += ((b&(c^d))^d) + 0x5A827999;
+ else
+ t += ( b^c ^d) + 0x6ED9EBA1;
+ } else {
+ if (i < 60)
+ t += (((b|c)&d)|(b&c)) + 0x8F1BBCDC;
+ else
+ t += ( b^c ^d) + 0xCA62C1D6;
+ }
+ e = d;
+ d = c;
+ c = rol(b, 30);
+ b = a;
+ a = t;
+ }
+#else
+ for (i = 0; i < 15; i += 5) {
+ R0(a, b, c, d, e, 0 + i);
+ R0(e, a, b, c, d, 1 + i);
+ R0(d, e, a, b, c, 2 + i);
+ R0(c, d, e, a, b, 3 + i);
+ R0(b, c, d, e, a, 4 + i);
+ }
+ R0(a, b, c, d, e, 15);
+ R1(e, a, b, c, d, 16);
+ R1(d, e, a, b, c, 17);
+ R1(c, d, e, a, b, 18);
+ R1(b, c, d, e, a, 19);
+ for (i = 20; i < 40; i += 5) {
+ R2(a, b, c, d, e, 0 + i);
+ R2(e, a, b, c, d, 1 + i);
+ R2(d, e, a, b, c, 2 + i);
+ R2(c, d, e, a, b, 3 + i);
+ R2(b, c, d, e, a, 4 + i);
+ }
+ for (; i < 60; i += 5) {
+ R3(a, b, c, d, e, 0 + i);
+ R3(e, a, b, c, d, 1 + i);
+ R3(d, e, a, b, c, 2 + i);
+ R3(c, d, e, a, b, 3 + i);
+ R3(b, c, d, e, a, 4 + i);
+ }
+ for (; i < 80; i += 5) {
+ R4(a, b, c, d, e, 0 + i);
+ R4(e, a, b, c, d, 1 + i);
+ R4(d, e, a, b, c, 2 + i);
+ R4(c, d, e, a, b, 3 + i);
+ R4(b, c, d, e, a, 4 + i);
+ }
+#endif
+ state[0] += a;
+ state[1] += b;
+ state[2] += c;
+ state[3] += d;
+ state[4] += e;
+}
+
+static const uint32_t K256[64] = {
+ 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
+ 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
+ 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
+ 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
+ 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
+ 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
+ 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,
+ 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
+ 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
+ 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
+ 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,
+ 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
+ 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,
+ 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
+ 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
+ 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
+};
+
+
+#define Ch(x,y,z) (((x) & ((y) ^ (z))) ^ (z))
+#define Maj(x,y,z) ((((x) | (y)) & (z)) | ((x) & (y)))
+
+#define Sigma0_256(x) (rol((x), 30) ^ rol((x), 19) ^ rol((x), 10))
+#define Sigma1_256(x) (rol((x), 26) ^ rol((x), 21) ^ rol((x), 7))
+#define sigma0_256(x) (rol((x), 25) ^ rol((x), 14) ^ ((x) >> 3))
+#define sigma1_256(x) (rol((x), 15) ^ rol((x), 13) ^ ((x) >> 10))
+
+#undef blk
+#define blk(i) (block[i] = block[i - 16] + sigma0_256(block[i - 15]) + \
+ sigma1_256(block[i - 2]) + block[i - 7])
+
+#define ROUND256(a,b,c,d,e,f,g,h) \
+ T1 += (h) + Sigma1_256(e) + Ch((e), (f), (g)) + K256[i]; \
+ (d) += T1; \
+ (h) = T1 + Sigma0_256(a) + Maj((a), (b), (c)); \
+ i++
+
+#define ROUND256_0_TO_15(a,b,c,d,e,f,g,h) \
+ T1 = blk0(i); \
+ ROUND256(a,b,c,d,e,f,g,h)
+
+#define ROUND256_16_TO_63(a,b,c,d,e,f,g,h) \
+ T1 = blk(i); \
+ ROUND256(a,b,c,d,e,f,g,h)
+
+static void sha256_transform(uint32_t *state, const uint8_t buffer[64])
+{
+ unsigned int i, a, b, c, d, e, f, g, h;
+ uint32_t block[64];
+ uint32_t T1;
+
+ a = state[0];
+ b = state[1];
+ c = state[2];
+ d = state[3];
+ e = state[4];
+ f = state[5];
+ g = state[6];
+ h = state[7];
+#if CONFIG_SMALL
+ for (i = 0; i < 64; i++) {
+ uint32_t T2;
+ if (i < 16)
+ T1 = blk0(i);
+ else
+ T1 = blk(i);
+ T1 += h + Sigma1_256(e) + Ch(e, f, g) + K256[i];
+ T2 = Sigma0_256(a) + Maj(a, b, c);
+ h = g;
+ g = f;
+ f = e;
+ e = d + T1;
+ d = c;
+ c = b;
+ b = a;
+ a = T1 + T2;
+ }
+#else
+ for (i = 0; i < 16;) {
+ ROUND256_0_TO_15(a, b, c, d, e, f, g, h);
+ ROUND256_0_TO_15(h, a, b, c, d, e, f, g);
+ ROUND256_0_TO_15(g, h, a, b, c, d, e, f);
+ ROUND256_0_TO_15(f, g, h, a, b, c, d, e);
+ ROUND256_0_TO_15(e, f, g, h, a, b, c, d);
+ ROUND256_0_TO_15(d, e, f, g, h, a, b, c);
+ ROUND256_0_TO_15(c, d, e, f, g, h, a, b);
+ ROUND256_0_TO_15(b, c, d, e, f, g, h, a);
+ }
+
+ for (; i < 64;) {
+ ROUND256_16_TO_63(a, b, c, d, e, f, g, h);
+ ROUND256_16_TO_63(h, a, b, c, d, e, f, g);
+ ROUND256_16_TO_63(g, h, a, b, c, d, e, f);
+ ROUND256_16_TO_63(f, g, h, a, b, c, d, e);
+ ROUND256_16_TO_63(e, f, g, h, a, b, c, d);
+ ROUND256_16_TO_63(d, e, f, g, h, a, b, c);
+ ROUND256_16_TO_63(c, d, e, f, g, h, a, b);
+ ROUND256_16_TO_63(b, c, d, e, f, g, h, a);
+ }
+#endif
+ state[0] += a;
+ state[1] += b;
+ state[2] += c;
+ state[3] += d;
+ state[4] += e;
+ state[5] += f;
+ state[6] += g;
+ state[7] += h;
+}
+
+
+int av_sha_init(AVSHA* ctx, int bits)
+{
+ ctx->digest_len = bits >> 5;
+ switch (bits) {
+ case 160: // SHA-1
+ ctx->state[0] = 0x67452301;
+ ctx->state[1] = 0xEFCDAB89;
+ ctx->state[2] = 0x98BADCFE;
+ ctx->state[3] = 0x10325476;
+ ctx->state[4] = 0xC3D2E1F0;
+ ctx->transform = sha1_transform;
+ break;
+ case 224: // SHA-224
+ ctx->state[0] = 0xC1059ED8;
+ ctx->state[1] = 0x367CD507;
+ ctx->state[2] = 0x3070DD17;
+ ctx->state[3] = 0xF70E5939;
+ ctx->state[4] = 0xFFC00B31;
+ ctx->state[5] = 0x68581511;
+ ctx->state[6] = 0x64F98FA7;
+ ctx->state[7] = 0xBEFA4FA4;
+ ctx->transform = sha256_transform;
+ break;
+ case 256: // SHA-256
+ ctx->state[0] = 0x6A09E667;
+ ctx->state[1] = 0xBB67AE85;
+ ctx->state[2] = 0x3C6EF372;
+ ctx->state[3] = 0xA54FF53A;
+ ctx->state[4] = 0x510E527F;
+ ctx->state[5] = 0x9B05688C;
+ ctx->state[6] = 0x1F83D9AB;
+ ctx->state[7] = 0x5BE0CD19;
+ ctx->transform = sha256_transform;
+ break;
+ default:
+ return -1;
+ }
+ ctx->count = 0;
+ return 0;
+}
+
+void av_sha_update(AVSHA* ctx, const uint8_t* data, unsigned int len)
+{
+ unsigned int i, j;
+
+ j = ctx->count & 63;
+ ctx->count += len;
+#if CONFIG_SMALL
+ for (i = 0; i < len; i++) {
+ ctx->buffer[j++] = data[i];
+ if (64 == j) {
+ ctx->transform(ctx->state, ctx->buffer);
+ j = 0;
+ }
+ }
+#else
+ if ((j + len) > 63) {
+ memcpy(&ctx->buffer[j], data, (i = 64 - j));
+ ctx->transform(ctx->state, ctx->buffer);
+ for (; i + 63 < len; i += 64)
+ ctx->transform(ctx->state, &data[i]);
+ j = 0;
+ } else
+ i = 0;
+ memcpy(&ctx->buffer[j], &data[i], len - i);
+#endif
+}
+
+void av_sha_final(AVSHA* ctx, uint8_t *digest)
+{
+ int i;
+ uint64_t finalcount = av_be2ne64(ctx->count << 3);
+
+ av_sha_update(ctx, "\200", 1);
+ while ((ctx->count & 63) != 56)
+ av_sha_update(ctx, "", 1);
+ av_sha_update(ctx, (uint8_t *)&finalcount, 8); /* Should cause a transform() */
+ for (i = 0; i < ctx->digest_len; i++)
+ AV_WB32(digest + i*4, ctx->state[i]);
+}
+
+#ifdef TEST
+#include <stdio.h>
+#undef printf
+
+int main(void)
+{
+ int i, j, k;
+ AVSHA ctx;
+ unsigned char digest[32];
+ const int lengths[3] = { 160, 224, 256 };
+
+ for (j = 0; j < 3; j++) {
+ printf("Testing SHA-%d\n", lengths[j]);
+ for (k = 0; k < 3; k++) {
+ av_sha_init(&ctx, lengths[j]);
+ if (k == 0)
+ av_sha_update(&ctx, "abc", 3);
+ else if (k == 1)
+ av_sha_update(&ctx, "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", 56);
+ else
+ for (i = 0; i < 1000*1000; i++)
+ av_sha_update(&ctx, "a", 1);
+ av_sha_final(&ctx, digest);
+ for (i = 0; i < lengths[j] >> 3; i++)
+ printf("%02X", digest[i]);
+ putchar('\n');
+ }
+ switch (j) {
+ case 0:
+ //test vectors (from FIPS PUB 180-1)
+ printf("A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D\n"
+ "84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1\n"
+ "34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F\n");
+ break;
+ case 1:
+ //test vectors (from FIPS PUB 180-2 Appendix A)
+ printf("23097d22 3405d822 8642a477 bda255b3 2aadbce4 bda0b3f7 e36c9da7\n"
+ "75388b16 512776cc 5dba5da1 fd890150 b0c6455c b4f58b19 52522525\n"
+ "20794655 980c91d8 bbb4c1ea 97618a4b f03f4258 1948b2ee 4ee7ad67\n");
+ break;
+ case 2:
+ //test vectors (from FIPS PUB 180-2)
+ printf("ba7816bf 8f01cfea 414140de 5dae2223 b00361a3 96177a9c b410ff61 f20015ad\n"
+ "248d6a61 d20638b8 e5c02693 0c3e6039 a33ce459 64ff2167 f6ecedd4 19db06c1\n"
+ "cdc76e5c 9914fb92 81a1c7e2 84d73e67 f1809a48 a497200e 046d39cc c7112cd0\n");
+ break;
+ }
+ }
+
+ return 0;
+}
+#endif
diff --git a/src/thirdparty/ffmpeg/libavutil/sha.h b/src/thirdparty/ffmpeg/libavutil/sha.h
new file mode 100644
index 000000000..895e47e4f
--- /dev/null
+++ b/src/thirdparty/ffmpeg/libavutil/sha.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2007 Michael Niedermayer <michaelni@gmx.at>
+ *
+ * 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_SHA_H
+#define AVUTIL_SHA_H
+
+#include <stdint.h>
+
+/**
+ * @defgroup lavu_sha SHA
+ * @ingroup lavu_crypto
+ * @{
+ */
+
+extern const int av_sha_size;
+
+struct AVSHA;
+
+/**
+ * Initialize SHA-1 or SHA-2 hashing.
+ *
+ * @param context pointer to the function context (of size av_sha_size)
+ * @param bits number of bits in digest (SHA-1 - 160 bits, SHA-2 224 or 256 bits)
+ * @return zero if initialization succeeded, -1 otherwise
+ */
+int av_sha_init(struct AVSHA* context, int bits);
+
+/**
+ * Update hash value.
+ *
+ * @param context hash function context
+ * @param data input data to update hash with
+ * @param len input data length
+ */
+void av_sha_update(struct AVSHA* context, const uint8_t* data, unsigned int len);
+
+/**
+ * Finish hashing and output digest value.
+ *
+ * @param context hash function context
+ * @param digest buffer where output digest value is stored
+ */
+void av_sha_final(struct AVSHA* context, uint8_t *digest);
+
+/**
+ * @}
+ */
+
+#endif /* AVUTIL_SHA_H */
diff --git a/src/thirdparty/ffmpeg/libavutil/x86/float_dsp.asm b/src/thirdparty/ffmpeg/libavutil/x86/float_dsp.asm
index d98a4c7bb..9d613050b 100644
--- a/src/thirdparty/ffmpeg/libavutil/x86/float_dsp.asm
+++ b/src/thirdparty/ffmpeg/libavutil/x86/float_dsp.asm
@@ -1,20 +1,22 @@
;*****************************************************************************
;* x86-optimized Float DSP functions
;*
-;* This file is part of Libav.
+;* Copyright 2006 Loren Merritt
;*
-;* Libav is free software; you can redistribute it and/or
+;* 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.
;*
-;* Libav is distributed in the hope that it will be useful,
+;* 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 Libav; if not, write to the Free Software
+;* License along with FFmpeg; if not, write to the Free Software
;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;******************************************************************************
diff --git a/src/thirdparty/ffmpeg/libswscale/rgb2rgb.c b/src/thirdparty/ffmpeg/libswscale/rgb2rgb.c
index ef9b16f34..b532bcaf9 100644
--- a/src/thirdparty/ffmpeg/libswscale/rgb2rgb.c
+++ b/src/thirdparty/ffmpeg/libswscale/rgb2rgb.c
@@ -26,6 +26,7 @@
#include <inttypes.h>
#include "libavutil/bswap.h"
+#include "libavutil/intreadwrite.h"
#include "config.h"
#include "rgb2rgb.h"
#include "swscale.h"
@@ -333,3 +334,21 @@ DEFINE_SHUFFLE_BYTES(0, 3, 2, 1)
DEFINE_SHUFFLE_BYTES(1, 2, 3, 0)
DEFINE_SHUFFLE_BYTES(3, 0, 1, 2)
DEFINE_SHUFFLE_BYTES(3, 2, 1, 0)
+
+#define DEFINE_RGB48TOBGR48(ie, oe) \
+void rgb48tobgr48_ ## ie ## oe(const uint8_t *src, \
+ uint8_t *dst, int src_size) \
+{ \
+ uint16_t *d = (uint16_t *)dst; \
+ uint16_t *s = (uint16_t *)src; \
+ int i, num_pixels = src_size >> 1; \
+ \
+ for (i = 0; i < num_pixels; i += 3) { \
+ AV_W ## oe ## 16(&d[i ], AV_R ## ie ## 16(&s[i + 2])); \
+ AV_W ## oe ## 16(&d[i + 1], AV_R ## ie ## 16(&s[i + 1])); \
+ AV_W ## oe ## 16(&d[i + 2], AV_R ## ie ## 16(&s[i ])); \
+ } \
+}
+
+DEFINE_RGB48TOBGR48(L, L)
+DEFINE_RGB48TOBGR48(L, B)
diff --git a/src/thirdparty/ffmpeg/libswscale/rgb2rgb.h b/src/thirdparty/ffmpeg/libswscale/rgb2rgb.h
index 8a098d677..719476b72 100644
--- a/src/thirdparty/ffmpeg/libswscale/rgb2rgb.h
+++ b/src/thirdparty/ffmpeg/libswscale/rgb2rgb.h
@@ -52,6 +52,8 @@ extern void (*rgb32tobgr15)(const uint8_t *src, uint8_t *dst, int src_size);
extern void (*shuffle_bytes_2103)(const uint8_t *src, uint8_t *dst, int src_size);
+void rgb48tobgr48_LL(const uint8_t *src, uint8_t *dst, int src_size);
+void rgb48tobgr48_LB(const uint8_t *src, uint8_t *dst, int src_size);
void rgb24to32(const uint8_t *src, uint8_t *dst, int src_size);
void rgb32to24(const uint8_t *src, uint8_t *dst, int src_size);
void rgb16tobgr32(const uint8_t *src, uint8_t *dst, int src_size);
diff --git a/src/thirdparty/ffmpeg/libswscale/swscale_unscaled.c b/src/thirdparty/ffmpeg/libswscale/swscale_unscaled.c
index 90356ffb1..00a1f404d 100644
--- a/src/thirdparty/ffmpeg/libswscale/swscale_unscaled.c
+++ b/src/thirdparty/ffmpeg/libswscale/swscale_unscaled.c
@@ -521,6 +521,13 @@ static int planarRgbToRgbWrapper(SwsContext *c, const uint8_t *src[],
|| (x) == PIX_FMT_ABGR \
)
+#define isRGB48(x) ( \
+ (x) == PIX_FMT_RGB48LE \
+ || (x) == PIX_FMT_RGB48BE \
+ || (x) == PIX_FMT_BGR48LE \
+ || (x) == PIX_FMT_BGR48BE \
+ )
+
/* {RGB,BGR}{15,16,24,32,32_1} -> {RGB,BGR}{15,16,24,32} */
typedef void (* rgbConvFn) (const uint8_t *, uint8_t *, int);
static rgbConvFn findRgbConvFn(SwsContext *c)
@@ -554,6 +561,15 @@ static rgbConvFn findRgbConvFn(SwsContext *c)
|| CONV_IS(RGBA, BGRA)) conv = shuffle_bytes_2103;
else if (CONV_IS(BGRA, ABGR)
|| CONV_IS(RGBA, ARGB)) conv = shuffle_bytes_3012;
+ } else if (isRGB48(srcFormat) && isRGB48(dstFormat)) {
+ if (CONV_IS(RGB48LE, BGR48LE)
+ || CONV_IS(BGR48LE, RGB48LE)
+ || CONV_IS(RGB48BE, BGR48BE)
+ || CONV_IS(BGR48BE, RGB48BE)) conv = rgb48tobgr48_LL;
+ else if (CONV_IS(RGB48LE, BGR48BE)
+ || CONV_IS(BGR48LE, RGB48BE)
+ || CONV_IS(RGB48BE, BGR48LE)
+ || CONV_IS(BGR48BE, RGB48LE)) conv = rgb48tobgr48_LB;
} else
/* BGR -> BGR */
if ((isBGRinInt(srcFormat) && isBGRinInt(dstFormat)) ||