aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-02-14 13:50:03 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-02-14 13:50:08 +0100
commit7d3e2176231716e6ebddb3ae406245d500979ea8 (patch)
treebf155cae9debeda16a9c4d8b3b3c6cb1dd80f907
parent2ac6b573a4083e5b840f3577a063237ae0088401 (diff)
parent5310da7e83ec9f149dac4c2c5a64e1a24951259e (diff)
downloadffmpeg-7d3e2176231716e6ebddb3ae406245d500979ea8.tar.gz
Merge remote-tracking branch 'qatar/release/9' into release/1.1
* qatar/release/9: arm: Fall back to runtime cpu feature detection via /proc/cpuinfo doc/platform: Fix 10l typo xxan: properly handle odd heights. Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/xxan.c15
-rw-r--r--libavutil/arm/cpu.c35
-rw-r--r--tests/ref/fate/xxan-wc442
3 files changed, 70 insertions, 22 deletions
diff --git a/libavcodec/xxan.c b/libavcodec/xxan.c
index ed1821772f..2476f5dea1 100644
--- a/libavcodec/xxan.c
+++ b/libavcodec/xxan.c
@@ -45,6 +45,11 @@ static av_cold int xan_decode_init(AVCodecContext *avctx)
avctx->pix_fmt = AV_PIX_FMT_YUV420P;
+ if (avctx->height < 8) {
+ av_log(avctx, AV_LOG_ERROR, "Invalid frame height: %d.\n", avctx->height);
+ return AVERROR(EINVAL);
+ }
+
s->buffer_size = avctx->width * avctx->height;
s->y_buffer = av_malloc(s->buffer_size);
if (!s->y_buffer)
@@ -212,6 +217,10 @@ static int xan_decode_chroma(AVCodecContext *avctx, unsigned chroma_off)
U += s->pic.linesize[1];
V += s->pic.linesize[2];
}
+ if (avctx->height & 1) {
+ memcpy(U, U - s->pic.linesize[1], avctx->width >> 1);
+ memcpy(V, V - s->pic.linesize[2], avctx->width >> 1);
+ }
} else {
uint8_t *U2 = U + s->pic.linesize[1];
uint8_t *V2 = V + s->pic.linesize[2];
@@ -236,6 +245,12 @@ static int xan_decode_chroma(AVCodecContext *avctx, unsigned chroma_off)
U2 += s->pic.linesize[1] * 2;
V2 += s->pic.linesize[2] * 2;
}
+ if (avctx->height & 3) {
+ int lines = ((avctx->height + 1) >> 1) - (avctx->height >> 2) * 2;
+
+ memcpy(U, U - lines * s->pic.linesize[1], lines * s->pic.linesize[1]);
+ memcpy(V, V - lines * s->pic.linesize[2], lines * s->pic.linesize[2]);
+ }
}
return 0;
diff --git a/libavutil/arm/cpu.c b/libavutil/arm/cpu.c
index 041afc985a..b4aabc375e 100644
--- a/libavutil/arm/cpu.c
+++ b/libavutil/arm/cpu.c
@@ -34,6 +34,8 @@
#include <stdint.h>
#include <stdio.h>
+#include <string.h>
+#include "libavutil/avstring.h"
#define AT_HWCAP 16
@@ -66,13 +68,44 @@ static int get_hwcap(uint32_t *hwcap)
return err;
}
+static int get_cpuinfo(uint32_t *hwcap)
+{
+ FILE *f = fopen("/proc/cpuinfo", "r");
+ char buf[200];
+
+ if (!f)
+ return -1;
+
+ *hwcap = 0;
+ while (fgets(buf, sizeof(buf), f)) {
+ if (av_strstart(buf, "Features", NULL)) {
+ if (strstr(buf, " edsp "))
+ *hwcap |= HWCAP_EDSP;
+ if (strstr(buf, " tls "))
+ *hwcap |= HWCAP_TLS;
+ if (strstr(buf, " thumbee "))
+ *hwcap |= HWCAP_THUMBEE;
+ if (strstr(buf, " vfp "))
+ *hwcap |= HWCAP_VFP;
+ if (strstr(buf, " vfpv3 "))
+ *hwcap |= HWCAP_VFPv3;
+ if (strstr(buf, " neon "))
+ *hwcap |= HWCAP_NEON;
+ break;
+ }
+ }
+ fclose(f);
+ return 0;
+}
+
int ff_get_cpu_flags_arm(void)
{
int flags = CORE_CPU_FLAGS;
uint32_t hwcap;
if (get_hwcap(&hwcap) < 0)
- return flags;
+ if (get_cpuinfo(&hwcap) < 0)
+ return flags;
#define check_cap(cap, flag) do { \
if (hwcap & HWCAP_ ## cap) \
diff --git a/tests/ref/fate/xxan-wc4 b/tests/ref/fate/xxan-wc4
index 34857bfd26..88dcc98ac5 100644
--- a/tests/ref/fate/xxan-wc4
+++ b/tests/ref/fate/xxan-wc4
@@ -1,22 +1,22 @@
#tb 0: 1/15
-0, 0, 0, 1, 79360, 0x3b0a7d1b
-0, 1, 1, 1, 79360, 0x740842c3
-0, 2, 2, 1, 79360, 0x85160167
-0, 3, 3, 1, 79360, 0xaf510e92
-0, 4, 4, 1, 79360, 0x8e290bec
-0, 5, 5, 1, 79360, 0x51e981b0
-0, 6, 6, 1, 79360, 0x16e52c60
-0, 7, 7, 1, 79360, 0x66e1e60a
-0, 8, 8, 1, 79360, 0x40fa58f6
-0, 9, 9, 1, 79360, 0x00388edd
-0, 10, 10, 1, 79360, 0xc74f95bf
-0, 11, 11, 1, 79360, 0xf446a3fd
-0, 12, 12, 1, 79360, 0x27b5eb60
-0, 13, 13, 1, 79360, 0xea9266a2
-0, 14, 14, 1, 79360, 0x7b6a7907
-0, 15, 15, 1, 79360, 0x2be7d946
-0, 16, 16, 1, 79360, 0x61881ee4
-0, 17, 17, 1, 79360, 0x9214bd4f
-0, 18, 18, 1, 79360, 0xeb294afe
-0, 19, 19, 1, 79360, 0xc861ad55
-0, 20, 20, 1, 79360, 0x3d3b6220
+0, 0, 0, 1, 79360, 0x8537821b
+0, 1, 1, 1, 79360, 0x110c4343
+0, 2, 2, 1, 79360, 0xa85105bb
+0, 3, 3, 1, 79360, 0x87431836
+0, 4, 4, 1, 79360, 0x5c701720
+0, 5, 5, 1, 79360, 0x20308ce4
+0, 6, 6, 1, 79360, 0xe51d3794
+0, 7, 7, 1, 79360, 0x80e6f1e0
+0, 8, 8, 1, 79360, 0x5aff64cc
+0, 9, 9, 1, 79360, 0x1a3d9ab3
+0, 10, 10, 1, 79360, 0xe154a195
+0, 11, 11, 1, 79360, 0x608dafdc
+0, 12, 12, 1, 79360, 0x93edf73f
+0, 13, 13, 1, 79360, 0x56d97281
+0, 14, 14, 1, 79360, 0xe7a284e6
+0, 15, 15, 1, 79360, 0xd4e5e513
+0, 16, 16, 1, 79360, 0x0a952ab1
+0, 17, 17, 1, 79360, 0x3b21c91c
+0, 18, 18, 1, 79360, 0x943656cb
+0, 19, 19, 1, 79360, 0xffbdb94b
+0, 20, 20, 1, 79360, 0x74976e16