summaryrefslogtreecommitdiff
path: root/media
diff options
context:
space:
mode:
Diffstat (limited to 'media')
-rw-r--r--media/ffvpx/changes.patch231
-rw-r--r--media/ffvpx/libavcodec/h264pred.c9
-rw-r--r--media/ffvpx/libavcodec/videodsp.c11
-rw-r--r--media/ffvpx/libavcodec/vp8dsp.c18
-rw-r--r--media/ffvpx/libavcodec/vp9dsp.c13
-rw-r--r--media/ffvpx/libavutil/cpu.c57
-rw-r--r--media/ffvpx/libavutil/float_dsp.c11
-rw-r--r--media/libav/libavcodec/fft_template.c25
-rw-r--r--media/libav/libavutil/cpu.c9
-rw-r--r--media/libav/moz-libav.patch62
10 files changed, 382 insertions, 64 deletions
diff --git a/media/ffvpx/changes.patch b/media/ffvpx/changes.patch
index 49a49b26b7..b3a1125dc0 100644
--- a/media/ffvpx/changes.patch
+++ b/media/ffvpx/changes.patch
@@ -50,3 +50,234 @@ index 9fb8d0a..97ad3b9 100644
rgba_color[0] = rgba >> 24;
rgba_color[1] = rgba >> 16;
rgba_color[2] = rgba >> 8;
+
+
+diff --git a/media/ffvpx/libavcodec/h264pred.c b/media/ffvpx/libavcodec/h264pred.c
+index 5632a58fd..f9f3af50e 100644
+--- a/media/ffvpx/libavcodec/h264pred.c
++++ b/media/ffvpx/libavcodec/h264pred.c
+@@ -592,12 +592,13 @@ av_cold void ff_h264_pred_init(H264PredContext *h, int codec_id,
+ break;
+ }
+
+- if (ARCH_AARCH64)
++ #if ARCH_AARCH64 == 1
+ ff_h264_pred_init_aarch64(h, codec_id, bit_depth, chroma_format_idc);
+- if (ARCH_ARM)
++ #elif ARCH_ARM == 1
+ ff_h264_pred_init_arm(h, codec_id, bit_depth, chroma_format_idc);
+- if (ARCH_X86)
++ #elif ARCH_X86 == 1
+ ff_h264_pred_init_x86(h, codec_id, bit_depth, chroma_format_idc);
+- if (ARCH_MIPS)
++ #elif ARCH_MIPS == 1
+ ff_h264_pred_init_mips(h, codec_id, bit_depth, chroma_format_idc);
++ #endif
+ }
+diff --git a/media/ffvpx/libavcodec/videodsp.c b/media/ffvpx/libavcodec/videodsp.c
+index ce9e9eb14..4f082a426 100644
+--- a/media/ffvpx/libavcodec/videodsp.c
++++ b/media/ffvpx/libavcodec/videodsp.c
+@@ -44,14 +44,15 @@ av_cold void ff_videodsp_init(VideoDSPContext *ctx, int bpc)
+ ctx->emulated_edge_mc = ff_emulated_edge_mc_16;
+ }
+
+- if (ARCH_AARCH64)
++ #if ARCH_AARCH64 == 1
+ ff_videodsp_init_aarch64(ctx, bpc);
+- if (ARCH_ARM)
++ #elif ARCH_ARM == 1
+ ff_videodsp_init_arm(ctx, bpc);
+- if (ARCH_PPC)
++ #elif ARCH_PPC == 1
+ ff_videodsp_init_ppc(ctx, bpc);
+- if (ARCH_X86)
++ #elif ARCH_X86 == 1
+ ff_videodsp_init_x86(ctx, bpc);
+- if (ARCH_MIPS)
++ #elif ARCH_MIPS == 1
+ ff_videodsp_init_mips(ctx, bpc);
++ #endif
+ }
+diff --git a/media/ffvpx/libavcodec/vp8dsp.c b/media/ffvpx/libavcodec/vp8dsp.c
+index 4ff63d078..efaf3e71a 100644
+--- a/media/ffvpx/libavcodec/vp8dsp.c
++++ b/media/ffvpx/libavcodec/vp8dsp.c
+@@ -673,14 +673,15 @@ av_cold void ff_vp78dsp_init(VP8DSPContext *dsp)
+ VP78_BILINEAR_MC_FUNC(1, 8);
+ VP78_BILINEAR_MC_FUNC(2, 4);
+
+- if (ARCH_AARCH64)
++ #if ARCH_AARCH64 == 1
+ ff_vp78dsp_init_aarch64(dsp);
+- if (ARCH_ARM)
++ #elif ARCH_ARM == 1
+ ff_vp78dsp_init_arm(dsp);
+- if (ARCH_PPC)
++ #elif ARCH_PPC == 1
+ ff_vp78dsp_init_ppc(dsp);
+- if (ARCH_X86)
++ #elif ARCH_X86 == 1
+ ff_vp78dsp_init_x86(dsp);
++ #endif
+ }
+
+ #if CONFIG_VP7_DECODER
+@@ -735,13 +736,14 @@ av_cold void ff_vp8dsp_init(VP8DSPContext *dsp)
+ dsp->vp8_v_loop_filter_simple = vp8_v_loop_filter_simple_c;
+ dsp->vp8_h_loop_filter_simple = vp8_h_loop_filter_simple_c;
+
+- if (ARCH_AARCH64)
++ #if ARCH_AARCH64 == 1
+ ff_vp8dsp_init_aarch64(dsp);
+- if (ARCH_ARM)
++ #elif ARCH_ARM == 1
+ ff_vp8dsp_init_arm(dsp);
+- if (ARCH_X86)
++ #elif ARCH_X86 == 1
+ ff_vp8dsp_init_x86(dsp);
+- if (ARCH_MIPS)
++ #elif ARCH_MIPS == 1
+ ff_vp8dsp_init_mips(dsp);
++ #endif
+ }
+ #endif /* CONFIG_VP8_DECODER */
+diff --git a/media/ffvpx/libavcodec/vp9dsp.c b/media/ffvpx/libavcodec/vp9dsp.c
+index f6d73f73c..b8fa3be36 100644
+--- a/media/ffvpx/libavcodec/vp9dsp.c
++++ b/media/ffvpx/libavcodec/vp9dsp.c
+@@ -92,8 +92,13 @@ av_cold void ff_vp9dsp_init(VP9DSPContext *dsp, int bpp, int bitexact)
+ ff_vp9dsp_init_12(dsp);
+ }
+
+- if (ARCH_AARCH64) ff_vp9dsp_init_aarch64(dsp, bpp);
+- if (ARCH_ARM) ff_vp9dsp_init_arm(dsp, bpp);
+- if (ARCH_X86) ff_vp9dsp_init_x86(dsp, bpp, bitexact);
+- if (ARCH_MIPS) ff_vp9dsp_init_mips(dsp, bpp);
++ #if ARCH_AARCH64 == 1
++ ff_vp9dsp_init_aarch64(dsp, bpp);
++ #elif ARCH_ARM == 1
++ ff_vp9dsp_init_arm(dsp, bpp);
++ #elif ARCH_X86 == 1
++ ff_vp9dsp_init_x86(dsp, bpp, bitexact);
++ #elif ARCH_MIPS == 1
++ ff_vp9dsp_init_mips(dsp, bpp);
++ #endif
+ }
+diff --git a/media/ffvpx/libavutil/cpu.c b/media/ffvpx/libavutil/cpu.c
+index 6548cc304..2cf1a3829 100644
+--- a/media/ffvpx/libavutil/cpu.c
++++ b/media/ffvpx/libavutil/cpu.c
+@@ -51,41 +51,43 @@ static atomic_int cpu_flags = ATOMIC_VAR_INIT(-1);
+
+ static int get_cpu_flags(void)
+ {
+- if (ARCH_AARCH64)
++ #if ARCH_AARCH64 == 1
+ return ff_get_cpu_flags_aarch64();
+- if (ARCH_ARM)
++ #elif ARCH_ARM == 1
+ return ff_get_cpu_flags_arm();
+- if (ARCH_PPC)
++ #elif ARCH_PPC == 1
+ return ff_get_cpu_flags_ppc();
+- if (ARCH_X86)
++ #elif ARCH_X86 == 1
+ return ff_get_cpu_flags_x86();
++ #endif
+ return 0;
+ }
+
+ void av_force_cpu_flags(int arg){
+- if (ARCH_X86 &&
+- (arg & ( AV_CPU_FLAG_3DNOW |
+- AV_CPU_FLAG_3DNOWEXT |
+- AV_CPU_FLAG_MMXEXT |
+- AV_CPU_FLAG_SSE |
+- AV_CPU_FLAG_SSE2 |
+- AV_CPU_FLAG_SSE2SLOW |
+- AV_CPU_FLAG_SSE3 |
+- AV_CPU_FLAG_SSE3SLOW |
+- AV_CPU_FLAG_SSSE3 |
+- AV_CPU_FLAG_SSE4 |
+- AV_CPU_FLAG_SSE42 |
+- AV_CPU_FLAG_AVX |
+- AV_CPU_FLAG_AVXSLOW |
+- AV_CPU_FLAG_XOP |
+- AV_CPU_FLAG_FMA3 |
+- AV_CPU_FLAG_FMA4 |
+- AV_CPU_FLAG_AVX2 |
+- AV_CPU_FLAG_AVX512 ))
++ #if ARCH_X86 == 1
++ if ((arg & (AV_CPU_FLAG_3DNOW |
++ AV_CPU_FLAG_3DNOWEXT |
++ AV_CPU_FLAG_MMXEXT |
++ AV_CPU_FLAG_SSE |
++ AV_CPU_FLAG_SSE2 |
++ AV_CPU_FLAG_SSE2SLOW |
++ AV_CPU_FLAG_SSE3 |
++ AV_CPU_FLAG_SSE3SLOW |
++ AV_CPU_FLAG_SSSE3 |
++ AV_CPU_FLAG_SSE4 |
++ AV_CPU_FLAG_SSE42 |
++ AV_CPU_FLAG_AVX |
++ AV_CPU_FLAG_AVXSLOW |
++ AV_CPU_FLAG_XOP |
++ AV_CPU_FLAG_FMA3 |
++ AV_CPU_FLAG_FMA4 |
++ AV_CPU_FLAG_AVX2 |
++ AV_CPU_FLAG_AVX512 ))
+ && !(arg & AV_CPU_FLAG_MMX)) {
+ av_log(NULL, AV_LOG_WARNING, "MMX implied by specified flags\n");
+ arg |= AV_CPU_FLAG_MMX;
+ }
++ #endif
+
+ atomic_store_explicit(&cpu_flags, arg, memory_order_relaxed);
+ }
+@@ -308,14 +310,15 @@ int av_cpu_count(void)
+
+ size_t av_cpu_max_align(void)
+ {
+- if (ARCH_AARCH64)
++ #if ARCH_AARCH64 == 1
+ return ff_get_cpu_max_align_aarch64();
+- if (ARCH_ARM)
++ #elif ARCH_ARM == 1
+ return ff_get_cpu_max_align_arm();
+- if (ARCH_PPC)
++ #elif ARCH_PPC == 1
+ return ff_get_cpu_max_align_ppc();
+- if (ARCH_X86)
++ #elif ARCH_X86 == 1
+ return ff_get_cpu_max_align_x86();
++ #endif
+
+ return 8;
+ }
+diff --git a/media/ffvpx/libavutil/float_dsp.c b/media/ffvpx/libavutil/float_dsp.c
+index 6e28d71b5..6c30dafc5 100644
+--- a/media/ffvpx/libavutil/float_dsp.c
++++ b/media/ffvpx/libavutil/float_dsp.c
+@@ -150,15 +150,16 @@ av_cold AVFloatDSPContext *avpriv_float_dsp_alloc(int bit_exact)
+ fdsp->butterflies_float = butterflies_float_c;
+ fdsp->scalarproduct_float = avpriv_scalarproduct_float_c;
+
+- if (ARCH_AARCH64)
++ #if ARCH_AARCH64 == 1
+ ff_float_dsp_init_aarch64(fdsp);
+- if (ARCH_ARM)
++ #elif ARCH_ARM == 1
+ ff_float_dsp_init_arm(fdsp);
+- if (ARCH_PPC)
++ #elif ARCH_PPC == 1
+ ff_float_dsp_init_ppc(fdsp, bit_exact);
+- if (ARCH_X86)
++ #elif ARCH_X86 == 1
+ ff_float_dsp_init_x86(fdsp);
+- if (ARCH_MIPS)
++ #elif ARCH_MIPS == 1
+ ff_float_dsp_init_mips(fdsp);
++ #endif
+ return fdsp;
+ } \ No newline at end of file
diff --git a/media/ffvpx/libavcodec/h264pred.c b/media/ffvpx/libavcodec/h264pred.c
index 5632a58fd7..f9f3af50e2 100644
--- a/media/ffvpx/libavcodec/h264pred.c
+++ b/media/ffvpx/libavcodec/h264pred.c
@@ -592,12 +592,13 @@ av_cold void ff_h264_pred_init(H264PredContext *h, int codec_id,
break;
}
- if (ARCH_AARCH64)
+ #if ARCH_AARCH64 == 1
ff_h264_pred_init_aarch64(h, codec_id, bit_depth, chroma_format_idc);
- if (ARCH_ARM)
+ #elif ARCH_ARM == 1
ff_h264_pred_init_arm(h, codec_id, bit_depth, chroma_format_idc);
- if (ARCH_X86)
+ #elif ARCH_X86 == 1
ff_h264_pred_init_x86(h, codec_id, bit_depth, chroma_format_idc);
- if (ARCH_MIPS)
+ #elif ARCH_MIPS == 1
ff_h264_pred_init_mips(h, codec_id, bit_depth, chroma_format_idc);
+ #endif
}
diff --git a/media/ffvpx/libavcodec/videodsp.c b/media/ffvpx/libavcodec/videodsp.c
index ce9e9eb143..4f082a4267 100644
--- a/media/ffvpx/libavcodec/videodsp.c
+++ b/media/ffvpx/libavcodec/videodsp.c
@@ -44,14 +44,15 @@ av_cold void ff_videodsp_init(VideoDSPContext *ctx, int bpc)
ctx->emulated_edge_mc = ff_emulated_edge_mc_16;
}
- if (ARCH_AARCH64)
+ #if ARCH_AARCH64 == 1
ff_videodsp_init_aarch64(ctx, bpc);
- if (ARCH_ARM)
+ #elif ARCH_ARM == 1
ff_videodsp_init_arm(ctx, bpc);
- if (ARCH_PPC)
+ #elif ARCH_PPC == 1
ff_videodsp_init_ppc(ctx, bpc);
- if (ARCH_X86)
+ #elif ARCH_X86 == 1
ff_videodsp_init_x86(ctx, bpc);
- if (ARCH_MIPS)
+ #elif ARCH_MIPS == 1
ff_videodsp_init_mips(ctx, bpc);
+ #endif
}
diff --git a/media/ffvpx/libavcodec/vp8dsp.c b/media/ffvpx/libavcodec/vp8dsp.c
index 4ff63d0784..efaf3e71a7 100644
--- a/media/ffvpx/libavcodec/vp8dsp.c
+++ b/media/ffvpx/libavcodec/vp8dsp.c
@@ -673,14 +673,15 @@ av_cold void ff_vp78dsp_init(VP8DSPContext *dsp)
VP78_BILINEAR_MC_FUNC(1, 8);
VP78_BILINEAR_MC_FUNC(2, 4);
- if (ARCH_AARCH64)
+ #if ARCH_AARCH64 == 1
ff_vp78dsp_init_aarch64(dsp);
- if (ARCH_ARM)
+ #elif ARCH_ARM == 1
ff_vp78dsp_init_arm(dsp);
- if (ARCH_PPC)
+ #elif ARCH_PPC == 1
ff_vp78dsp_init_ppc(dsp);
- if (ARCH_X86)
+ #elif ARCH_X86 == 1
ff_vp78dsp_init_x86(dsp);
+ #endif
}
#if CONFIG_VP7_DECODER
@@ -735,13 +736,14 @@ av_cold void ff_vp8dsp_init(VP8DSPContext *dsp)
dsp->vp8_v_loop_filter_simple = vp8_v_loop_filter_simple_c;
dsp->vp8_h_loop_filter_simple = vp8_h_loop_filter_simple_c;
- if (ARCH_AARCH64)
+ #if ARCH_AARCH64 == 1
ff_vp8dsp_init_aarch64(dsp);
- if (ARCH_ARM)
+ #elif ARCH_ARM == 1
ff_vp8dsp_init_arm(dsp);
- if (ARCH_X86)
+ #elif ARCH_X86 == 1
ff_vp8dsp_init_x86(dsp);
- if (ARCH_MIPS)
+ #elif ARCH_MIPS == 1
ff_vp8dsp_init_mips(dsp);
+ #endif
}
#endif /* CONFIG_VP8_DECODER */
diff --git a/media/ffvpx/libavcodec/vp9dsp.c b/media/ffvpx/libavcodec/vp9dsp.c
index f6d73f73cd..b8fa3be36d 100644
--- a/media/ffvpx/libavcodec/vp9dsp.c
+++ b/media/ffvpx/libavcodec/vp9dsp.c
@@ -92,8 +92,13 @@ av_cold void ff_vp9dsp_init(VP9DSPContext *dsp, int bpp, int bitexact)
ff_vp9dsp_init_12(dsp);
}
- if (ARCH_AARCH64) ff_vp9dsp_init_aarch64(dsp, bpp);
- if (ARCH_ARM) ff_vp9dsp_init_arm(dsp, bpp);
- if (ARCH_X86) ff_vp9dsp_init_x86(dsp, bpp, bitexact);
- if (ARCH_MIPS) ff_vp9dsp_init_mips(dsp, bpp);
+ #if ARCH_AARCH64 == 1
+ ff_vp9dsp_init_aarch64(dsp, bpp);
+ #elif ARCH_ARM == 1
+ ff_vp9dsp_init_arm(dsp, bpp);
+ #elif ARCH_X86 == 1
+ ff_vp9dsp_init_x86(dsp, bpp, bitexact);
+ #elif ARCH_MIPS == 1
+ ff_vp9dsp_init_mips(dsp, bpp);
+ #endif
}
diff --git a/media/ffvpx/libavutil/cpu.c b/media/ffvpx/libavutil/cpu.c
index 6548cc3042..2cf1a38297 100644
--- a/media/ffvpx/libavutil/cpu.c
+++ b/media/ffvpx/libavutil/cpu.c
@@ -51,41 +51,43 @@ static atomic_int cpu_flags = ATOMIC_VAR_INIT(-1);
static int get_cpu_flags(void)
{
- if (ARCH_AARCH64)
+ #if ARCH_AARCH64 == 1
return ff_get_cpu_flags_aarch64();
- if (ARCH_ARM)
+ #elif ARCH_ARM == 1
return ff_get_cpu_flags_arm();
- if (ARCH_PPC)
+ #elif ARCH_PPC == 1
return ff_get_cpu_flags_ppc();
- if (ARCH_X86)
+ #elif ARCH_X86 == 1
return ff_get_cpu_flags_x86();
+ #endif
return 0;
}
void av_force_cpu_flags(int arg){
- if (ARCH_X86 &&
- (arg & ( AV_CPU_FLAG_3DNOW |
- AV_CPU_FLAG_3DNOWEXT |
- AV_CPU_FLAG_MMXEXT |
- AV_CPU_FLAG_SSE |
- AV_CPU_FLAG_SSE2 |
- AV_CPU_FLAG_SSE2SLOW |
- AV_CPU_FLAG_SSE3 |
- AV_CPU_FLAG_SSE3SLOW |
- AV_CPU_FLAG_SSSE3 |
- AV_CPU_FLAG_SSE4 |
- AV_CPU_FLAG_SSE42 |
- AV_CPU_FLAG_AVX |
- AV_CPU_FLAG_AVXSLOW |
- AV_CPU_FLAG_XOP |
- AV_CPU_FLAG_FMA3 |
- AV_CPU_FLAG_FMA4 |
- AV_CPU_FLAG_AVX2 |
- AV_CPU_FLAG_AVX512 ))
+ #if ARCH_X86 == 1
+ if ((arg & (AV_CPU_FLAG_3DNOW |
+ AV_CPU_FLAG_3DNOWEXT |
+ AV_CPU_FLAG_MMXEXT |
+ AV_CPU_FLAG_SSE |
+ AV_CPU_FLAG_SSE2 |
+ AV_CPU_FLAG_SSE2SLOW |
+ AV_CPU_FLAG_SSE3 |
+ AV_CPU_FLAG_SSE3SLOW |
+ AV_CPU_FLAG_SSSE3 |
+ AV_CPU_FLAG_SSE4 |
+ AV_CPU_FLAG_SSE42 |
+ AV_CPU_FLAG_AVX |
+ AV_CPU_FLAG_AVXSLOW |
+ AV_CPU_FLAG_XOP |
+ AV_CPU_FLAG_FMA3 |
+ AV_CPU_FLAG_FMA4 |
+ AV_CPU_FLAG_AVX2 |
+ AV_CPU_FLAG_AVX512 ))
&& !(arg & AV_CPU_FLAG_MMX)) {
av_log(NULL, AV_LOG_WARNING, "MMX implied by specified flags\n");
arg |= AV_CPU_FLAG_MMX;
}
+ #endif
atomic_store_explicit(&cpu_flags, arg, memory_order_relaxed);
}
@@ -308,14 +310,15 @@ int av_cpu_count(void)
size_t av_cpu_max_align(void)
{
- if (ARCH_AARCH64)
+ #if ARCH_AARCH64 == 1
return ff_get_cpu_max_align_aarch64();
- if (ARCH_ARM)
+ #elif ARCH_ARM == 1
return ff_get_cpu_max_align_arm();
- if (ARCH_PPC)
+ #elif ARCH_PPC == 1
return ff_get_cpu_max_align_ppc();
- if (ARCH_X86)
+ #elif ARCH_X86 == 1
return ff_get_cpu_max_align_x86();
+ #endif
return 8;
}
diff --git a/media/ffvpx/libavutil/float_dsp.c b/media/ffvpx/libavutil/float_dsp.c
index 6e28d71b57..6c30dafc56 100644
--- a/media/ffvpx/libavutil/float_dsp.c
+++ b/media/ffvpx/libavutil/float_dsp.c
@@ -150,15 +150,16 @@ av_cold AVFloatDSPContext *avpriv_float_dsp_alloc(int bit_exact)
fdsp->butterflies_float = butterflies_float_c;
fdsp->scalarproduct_float = avpriv_scalarproduct_float_c;
- if (ARCH_AARCH64)
+ #if ARCH_AARCH64 == 1
ff_float_dsp_init_aarch64(fdsp);
- if (ARCH_ARM)
+ #elif ARCH_ARM == 1
ff_float_dsp_init_arm(fdsp);
- if (ARCH_PPC)
+ #elif ARCH_PPC == 1
ff_float_dsp_init_ppc(fdsp, bit_exact);
- if (ARCH_X86)
+ #elif ARCH_X86 == 1
ff_float_dsp_init_x86(fdsp);
- if (ARCH_MIPS)
+ #elif ARCH_MIPS == 1
ff_float_dsp_init_mips(fdsp);
+ #endif
return fdsp;
}
diff --git a/media/libav/libavcodec/fft_template.c b/media/libav/libavcodec/fft_template.c
index 808f317c17..9d21ffa6b5 100644
--- a/media/libav/libavcodec/fft_template.c
+++ b/media/libav/libavcodec/fft_template.c
@@ -158,14 +158,25 @@ av_cold int ff_fft_init(FFTContext *s, int nbits, int inverse)
#endif
#if FFT_FLOAT
- if (ARCH_AARCH64) ff_fft_init_aarch64(s);
- if (ARCH_ARM) ff_fft_init_arm(s);
- if (ARCH_PPC) ff_fft_init_ppc(s);
- if (ARCH_X86) ff_fft_init_x86(s);
- if (CONFIG_MDCT) s->mdct_calcw = s->mdct_calc;
+ #if ARCH_AARCH64 == 1
+ ff_fft_init_aarch64(s);
+ #elif ARCH_ARM == 1
+ ff_fft_init_arm(s);
+ #elif ARCH_PPC == 1
+ ff_fft_init_ppc(s);
+ #elif ARCH_X86 == 1
+ ff_fft_init_x86(s);
+ #endif
+ #if CONFIG_MDCT
+ s->mdct_calcw = s->mdct_calc;
+ #endif
#else
- if (CONFIG_MDCT) s->mdct_calcw = ff_mdct_calcw_c;
- if (ARCH_ARM) ff_fft_fixed_init_arm(s);
+ #if CONFIG_MDCT
+ s->mdct_calcw = ff_mdct_calcw_c;
+ #endif
+ #if ARCH_ARM == 1
+ ff_fft_fixed_init_arm(s);
+ #endif
#endif
for(j=4; j<=nbits; j++) {
diff --git a/media/libav/libavutil/cpu.c b/media/libav/libavutil/cpu.c
index 354d21e76f..6d100e95c1 100644
--- a/media/libav/libavutil/cpu.c
+++ b/media/libav/libavutil/cpu.c
@@ -51,14 +51,15 @@ int av_get_cpu_flags(void)
if (checked)
return flags;
- if (ARCH_AARCH64)
+ #if ARCH_AARCH64 == 1
flags = ff_get_cpu_flags_aarch64();
- if (ARCH_ARM)
+ #elif ARCH_ARM == 1
flags = ff_get_cpu_flags_arm();
- if (ARCH_PPC)
+ #elif ARCH_PPC == 1
flags = ff_get_cpu_flags_ppc();
- if (ARCH_X86)
+ #elif ARCH_X86 == 1
flags = ff_get_cpu_flags_x86();
+ #endif
flags &= cpuflags_mask;
checked = 1;
diff --git a/media/libav/moz-libav.patch b/media/libav/moz-libav.patch
index 5179e777cc..bdde7dad8e 100644
--- a/media/libav/moz-libav.patch
+++ b/media/libav/moz-libav.patch
@@ -11,3 +11,65 @@ index aed9925..03ee543 100644
#pragma comment(linker, "/include:"EXTERN_PREFIX"avpriv_strtod")
#pragma comment(linker, "/include:"EXTERN_PREFIX"avpriv_snprintf")
#endif
+
+diff --git a/media/libav/libavcodec/fft_template.c b/media/libav/libavcodec/fft_template.c
+index 808f317c1..9d21ffa6b 100644
+--- a/media/libav/libavcodec/fft_template.c
++++ b/media/libav/libavcodec/fft_template.c
+@@ -158,14 +158,25 @@ av_cold int ff_fft_init(FFTContext *s, int nbits, int inverse)
+ #endif
+
+ #if FFT_FLOAT
+- if (ARCH_AARCH64) ff_fft_init_aarch64(s);
+- if (ARCH_ARM) ff_fft_init_arm(s);
+- if (ARCH_PPC) ff_fft_init_ppc(s);
+- if (ARCH_X86) ff_fft_init_x86(s);
+- if (CONFIG_MDCT) s->mdct_calcw = s->mdct_calc;
++ #if ARCH_AARCH64 == 1
++ ff_fft_init_aarch64(s);
++ #elif ARCH_ARM == 1
++ ff_fft_init_arm(s);
++ #elif ARCH_PPC == 1
++ ff_fft_init_ppc(s);
++ #elif ARCH_X86 == 1
++ ff_fft_init_x86(s);
++ #endif
++ #if CONFIG_MDCT
++ s->mdct_calcw = s->mdct_calc;
++ #endif
+ #else
+- if (CONFIG_MDCT) s->mdct_calcw = ff_mdct_calcw_c;
+- if (ARCH_ARM) ff_fft_fixed_init_arm(s);
++ #if CONFIG_MDCT
++ s->mdct_calcw = ff_mdct_calcw_c;
++ #endif
++ #if ARCH_ARM == 1
++ ff_fft_fixed_init_arm(s);
++ #endif
+ #endif
+
+ for(j=4; j<=nbits; j++) {
+diff --git a/media/libav/libavutil/cpu.c b/media/libav/libavutil/cpu.c
+index 354d21e76..6d100e95c 100644
+--- a/media/libav/libavutil/cpu.c
++++ b/media/libav/libavutil/cpu.c
+@@ -51,14 +51,15 @@ int av_get_cpu_flags(void)
+ if (checked)
+ return flags;
+
+- if (ARCH_AARCH64)
++ #if ARCH_AARCH64 == 1
+ flags = ff_get_cpu_flags_aarch64();
+- if (ARCH_ARM)
++ #elif ARCH_ARM == 1
+ flags = ff_get_cpu_flags_arm();
+- if (ARCH_PPC)
++ #elif ARCH_PPC == 1
+ flags = ff_get_cpu_flags_ppc();
+- if (ARCH_X86)
++ #elif ARCH_X86 == 1
+ flags = ff_get_cpu_flags_x86();
++ #endif
+
+ flags &= cpuflags_mask;
+ checked = 1; \ No newline at end of file