summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbuild/make/ads2gas.pl26
-rw-r--r--vp8/common/entropy.c28
-rw-r--r--vp8/decoder/arm/armv5/dequantize_v5.asm52
-rw-r--r--vp8/decoder/dboolhuff.c13
-rw-r--r--vp8/decoder/dboolhuff.h4
-rw-r--r--vp8/decoder/detokenize.c4
-rw-r--r--vp8/encoder/bitstream.c24
-rw-r--r--vp8/encoder/boolhuff.c78
-rw-r--r--vp8/encoder/boolhuff.h71
-rw-r--r--vp8/encoder/lookahead.c3
-rw-r--r--vp8/encoder/onyx_if.c9
-rw-r--r--vp8/vp8_cx_iface.c7
-rw-r--r--vp8/vp8_dx_iface.c45
-rw-r--r--vpx/internal/vpx_codec_internal.h18
-rw-r--r--vpx_scale/generic/yv12config.c28
15 files changed, 192 insertions, 218 deletions
diff --git a/build/make/ads2gas.pl b/build/make/ads2gas.pl
index be4658253..388133aa2 100755
--- a/build/make/ads2gas.pl
+++ b/build/make/ads2gas.pl
@@ -21,6 +21,9 @@ print "@ This file was created from a .asm file\n";
print "@ using the ads2gas.pl script.\n";
print "\t.equ DO1STROUNDING, 0\n";
+# Stack of procedure names.
+@proc_stack = ();
+
while (<STDIN>)
{
# Load and store alignment
@@ -133,9 +136,23 @@ while (<STDIN>)
# Strip PRESERVE8
s/\sPRESERVE8/@ PRESERVE8/g;
- # Strip PROC and ENDPROC
- s/\sPROC/@/g;
- s/\sENDP/@/g;
+ # Use PROC and ENDP to give the symbols a .size directive.
+ # This makes them show up properly in debugging tools like gdb and valgrind.
+ if (/\bPROC\b/)
+ {
+ my $proc;
+ /^_([\.0-9A-Z_a-z]\w+)\b/;
+ $proc = $1;
+ push(@proc_stack, $proc) if ($proc);
+ s/\bPROC\b/@ $&/;
+ }
+ if (/\bENDP\b/)
+ {
+ my $proc;
+ s/\bENDP\b/@ $&/;
+ $proc = pop(@proc_stack);
+ $_ = "\t.size $proc, .-$proc".$_ if ($proc);
+ }
# EQU directive
s/(.*)EQU(.*)/.equ $1, $2/;
@@ -154,3 +171,6 @@ while (<STDIN>)
next if /^\s*END\s*$/;
print;
}
+
+# Mark that this object doesn't need an executable stack.
+printf ("\t.section\t.note.GNU-stack,\"\",\%\%progbits\n");
diff --git a/vp8/common/entropy.c b/vp8/common/entropy.c
index fba7a07ff..0eee60ec8 100644
--- a/vp8/common/entropy.c
+++ b/vp8/common/entropy.c
@@ -26,8 +26,32 @@ typedef vp8_prob Prob;
#include "coefupdateprobs.h"
-DECLARE_ALIGNED(16, cuchar, vp8_coef_bands[16]) = { 0, 1, 2, 3, 6, 4, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7};
-DECLARE_ALIGNED(16, cuchar, vp8_prev_token_class[MAX_ENTROPY_TOKENS]) = { 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0};
+DECLARE_ALIGNED(16, const unsigned char, vp8_norm[256]) =
+{
+ 0, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+
+DECLARE_ALIGNED(16, cuchar, vp8_coef_bands[16]) =
+{ 0, 1, 2, 3, 6, 4, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7};
+
+DECLARE_ALIGNED(16, cuchar, vp8_prev_token_class[MAX_ENTROPY_TOKENS]) =
+{ 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0};
+
DECLARE_ALIGNED(16, const int, vp8_default_zig_zag1d[16]) =
{
0, 1, 4, 8,
diff --git a/vp8/decoder/arm/armv5/dequantize_v5.asm b/vp8/decoder/arm/armv5/dequantize_v5.asm
deleted file mode 100644
index de3648ae2..000000000
--- a/vp8/decoder/arm/armv5/dequantize_v5.asm
+++ /dev/null
@@ -1,52 +0,0 @@
-;
-; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
-;
-; Use of this source code is governed by a BSD-style license
-; that can be found in the LICENSE file in the root of the source
-; tree. An additional intellectual property rights grant can be found
-; in the file PATENTS. All contributing project authors may
-; be found in the AUTHORS file in the root of the source tree.
-;
-
-
- EXPORT |vp8_dequantize_b_armv5|
-
- AREA |.text|, CODE, READONLY ; name this block of code
-
-q RN r0
-dqc RN r1
-cnt RN r2
-
-;void dequantize_b_armv5(short *Q, short *DQC)
-|vp8_dequantize_b_armv5| PROC
- stmdb sp!, {r4, lr}
- ldr r3, [q]
- ldr r4, [dqc], #8
-
- mov cnt, #4
-dequant_loop
- smulbb lr, r3, r4
- smultt r12, r3, r4
-
- ldr r3, [q, #4]
- ldr r4, [dqc, #-4]
-
- strh lr, [q], #2
- strh r12, [q], #2
-
- smulbb lr, r3, r4
- smultt r12, r3, r4
-
- subs cnt, cnt, #1
- ldrne r3, [q, #4]
- ldrne r4, [dqc], #8
-
- strh lr, [q], #2
- strh r12, [q], #2
-
- bne dequant_loop
-
- ldmia sp!, {r4, pc}
- ENDP ;|vp8_dequantize_b_arm|
-
- END
diff --git a/vp8/decoder/dboolhuff.c b/vp8/decoder/dboolhuff.c
index 8527d51e8..7e7b05aa6 100644
--- a/vp8/decoder/dboolhuff.c
+++ b/vp8/decoder/dboolhuff.c
@@ -13,19 +13,6 @@
#include "vpx_ports/mem.h"
#include "vpx_mem/vpx_mem.h"
-DECLARE_ALIGNED(16, const unsigned char, vp8dx_bitreader_norm[256]) =
-{
- 0, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-};
-
-
int vp8dx_start_decode(BOOL_DECODER *br,
const unsigned char *source,
unsigned int source_sz)
diff --git a/vp8/decoder/dboolhuff.h b/vp8/decoder/dboolhuff.h
index f729837f9..853c10f14 100644
--- a/vp8/decoder/dboolhuff.h
+++ b/vp8/decoder/dboolhuff.h
@@ -34,7 +34,7 @@ typedef struct
unsigned int range;
} BOOL_DECODER;
-DECLARE_ALIGNED(16, extern const unsigned char, vp8dx_bitreader_norm[256]);
+DECLARE_ALIGNED(16, extern const unsigned char, vp8_norm[256]);
int vp8dx_start_decode(BOOL_DECODER *br,
const unsigned char *source,
@@ -101,7 +101,7 @@ static int vp8dx_decode_bool(BOOL_DECODER *br, int probability) {
}
{
- register unsigned int shift = vp8dx_bitreader_norm[range];
+ register unsigned int shift = vp8_norm[range];
range <<= shift;
value <<= shift;
count -= shift;
diff --git a/vp8/decoder/detokenize.c b/vp8/decoder/detokenize.c
index c22e0f28c..166be9ef9 100644
--- a/vp8/decoder/detokenize.c
+++ b/vp8/decoder/detokenize.c
@@ -80,7 +80,7 @@ void vp8_reset_mb_tokens_context(MACROBLOCKD *x)
}
}
-DECLARE_ALIGNED(16, extern const unsigned char, vp8dx_bitreader_norm[256]);
+DECLARE_ALIGNED(16, extern const unsigned char, vp8_norm[256]);
#define FILL \
if(count < 0) \
VP8DX_BOOL_DECODER_FILL(count, value, bufptr, bufend);
@@ -88,7 +88,7 @@ DECLARE_ALIGNED(16, extern const unsigned char, vp8dx_bitreader_norm[256]);
#define NORMALIZE \
/*if(range < 0x80)*/ \
{ \
- shift = vp8dx_bitreader_norm[range]; \
+ shift = vp8_norm[range]; \
range <<= shift; \
value <<= shift; \
count -= shift; \
diff --git a/vp8/encoder/bitstream.c b/vp8/encoder/bitstream.c
index 134e84881..b3c24398c 100644
--- a/vp8/encoder/bitstream.c
+++ b/vp8/encoder/bitstream.c
@@ -158,18 +158,6 @@ static void write_split(vp8_writer *bc, int x)
);
}
-static const unsigned int norm[256] =
-{
- 0, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-};
-
static void pack_tokens_c(vp8_writer *w, const TOKENEXTRA *p, int xcount)
{
const TOKENEXTRA *const stop = p + xcount;
@@ -211,7 +199,7 @@ static void pack_tokens_c(vp8_writer *w, const TOKENEXTRA *p, int xcount)
range = split;
}
- shift = norm[range];
+ shift = vp8_norm[range];
range <<= shift;
count += shift;
@@ -271,7 +259,7 @@ static void pack_tokens_c(vp8_writer *w, const TOKENEXTRA *p, int xcount)
range = split;
}
- shift = norm[range];
+ shift = vp8_norm[range];
range <<= shift;
count += shift;
@@ -427,7 +415,7 @@ static void pack_tokens_into_partitions_c(VP8_COMP *cpi, unsigned char *cx_data,
range = split;
}
- shift = norm[range];
+ shift = vp8_norm[range];
range <<= shift;
count += shift;
@@ -487,7 +475,7 @@ static void pack_tokens_into_partitions_c(VP8_COMP *cpi, unsigned char *cx_data,
range = split;
}
- shift = norm[range];
+ shift = vp8_norm[range];
range <<= shift;
count += shift;
@@ -634,7 +622,7 @@ static void pack_mb_row_tokens_c(VP8_COMP *cpi, vp8_writer *w)
range = split;
}
- shift = norm[range];
+ shift = vp8_norm[range];
range <<= shift;
count += shift;
@@ -694,7 +682,7 @@ static void pack_mb_row_tokens_c(VP8_COMP *cpi, vp8_writer *w)
range = split;
}
- shift = norm[range];
+ shift = vp8_norm[range];
range <<= shift;
count += shift;
diff --git a/vp8/encoder/boolhuff.c b/vp8/encoder/boolhuff.c
index 788d2b05f..08ae66b8d 100644
--- a/vp8/encoder/boolhuff.c
+++ b/vp8/encoder/boolhuff.c
@@ -10,9 +10,6 @@
#include "boolhuff.h"
-#include "vp8/common/blockd.h"
-
-
#if defined(SECTIONBITS_OUTPUT)
unsigned __int64 Sectionbits[500];
@@ -62,81 +59,6 @@ void vp8_stop_encode(BOOL_CODER *br)
vp8_encode_bool(br, 0, 128);
}
-DECLARE_ALIGNED(16, static const unsigned int, norm[256]) =
-{
- 0, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-};
-
-void vp8_encode_bool(BOOL_CODER *br, int bit, int probability)
-{
- unsigned int split;
- int count = br->count;
- unsigned int range = br->range;
- unsigned int lowvalue = br->lowvalue;
- register unsigned int shift;
-
-#ifdef ENTROPY_STATS
-#if defined(SECTIONBITS_OUTPUT)
-
- if (bit)
- Sectionbits[active_section] += vp8_prob_cost[255-probability];
- else
- Sectionbits[active_section] += vp8_prob_cost[probability];
-
-#endif
-#endif
-
- split = 1 + (((range - 1) * probability) >> 8);
-
- range = split;
-
- if (bit)
- {
- lowvalue += split;
- range = br->range - split;
- }
-
- shift = norm[range];
-
- range <<= shift;
- count += shift;
-
- if (count >= 0)
- {
- int offset = shift - count;
-
- if ((lowvalue << (offset - 1)) & 0x80000000)
- {
- int x = br->pos - 1;
-
- while (x >= 0 && br->buffer[x] == 0xff)
- {
- br->buffer[x] = (unsigned char)0;
- x--;
- }
-
- br->buffer[x] += 1;
- }
-
- br->buffer[br->pos++] = (lowvalue >> (24 - offset));
- lowvalue <<= offset;
- shift = count;
- lowvalue &= 0xffffff;
- count -= 8 ;
- }
-
- lowvalue <<= shift;
- br->count = count;
- br->lowvalue = lowvalue;
- br->range = range;
-}
void vp8_encode_value(BOOL_CODER *br, int data, int bits)
{
diff --git a/vp8/encoder/boolhuff.h b/vp8/encoder/boolhuff.h
index f723da3f0..04755f532 100644
--- a/vp8/encoder/boolhuff.h
+++ b/vp8/encoder/boolhuff.h
@@ -19,6 +19,7 @@
#ifndef __INC_BOOLHUFF_H
#define __INC_BOOLHUFF_H
+#include "vpx_ports/mem.h"
typedef struct
{
@@ -35,9 +36,77 @@ typedef struct
} BOOL_CODER;
extern void vp8_start_encode(BOOL_CODER *bc, unsigned char *buffer);
-extern void vp8_encode_bool(BOOL_CODER *bc, int x, int context);
+
extern void vp8_encode_value(BOOL_CODER *br, int data, int bits);
extern void vp8_stop_encode(BOOL_CODER *bc);
extern const unsigned int vp8_prob_cost[256];
+
+DECLARE_ALIGNED(16, extern const unsigned char, vp8_norm[256]);
+
+
+static void vp8_encode_bool(BOOL_CODER *br, int bit, int probability)
+{
+ unsigned int split;
+ int count = br->count;
+ unsigned int range = br->range;
+ unsigned int lowvalue = br->lowvalue;
+ register unsigned int shift;
+
+#ifdef ENTROPY_STATS
+#if defined(SECTIONBITS_OUTPUT)
+
+ if (bit)
+ Sectionbits[active_section] += vp8_prob_cost[255-probability];
+ else
+ Sectionbits[active_section] += vp8_prob_cost[probability];
+
+#endif
+#endif
+
+ split = 1 + (((range - 1) * probability) >> 8);
+
+ range = split;
+
+ if (bit)
+ {
+ lowvalue += split;
+ range = br->range - split;
+ }
+
+ shift = vp8_norm[range];
+
+ range <<= shift;
+ count += shift;
+
+ if (count >= 0)
+ {
+ int offset = shift - count;
+
+ if ((lowvalue << (offset - 1)) & 0x80000000)
+ {
+ int x = br->pos - 1;
+
+ while (x >= 0 && br->buffer[x] == 0xff)
+ {
+ br->buffer[x] = (unsigned char)0;
+ x--;
+ }
+
+ br->buffer[x] += 1;
+ }
+
+ br->buffer[br->pos++] = (lowvalue >> (24 - offset));
+ lowvalue <<= offset;
+ shift = count;
+ lowvalue &= 0xffffff;
+ count -= 8 ;
+ }
+
+ lowvalue <<= shift;
+ br->count = count;
+ br->lowvalue = lowvalue;
+ br->range = range;
+}
+
#endif
diff --git a/vp8/encoder/lookahead.c b/vp8/encoder/lookahead.c
index 3b86d4094..d7f85cba1 100644
--- a/vp8/encoder/lookahead.c
+++ b/vp8/encoder/lookahead.c
@@ -86,7 +86,8 @@ vp8_lookahead_init(unsigned int width,
if(!ctx->buf)
goto bail;
for(i=0; i<depth; i++)
- if (vp8_yv12_alloc_frame_buffer(&ctx->buf[i].img, width, height, 16))
+ if (vp8_yv12_alloc_frame_buffer(&ctx->buf[i].img,
+ width, height, VP8BORDERINPIXELS))
goto bail;
}
return ctx;
diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c
index 37aeb4da5..51bf483cd 100644
--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -882,6 +882,10 @@ void vp8_set_speed_features(VP8_COMP *cpi)
sf->improved_quant = 0;
sf->improved_dct = 0;
+
+ sf->use_fastquant_for_pick = 1;
+ sf->no_skip_block4x4_search = 0;
+ sf->first_step = 1;
}
if (Speed > 1)
@@ -1240,7 +1244,7 @@ static void alloc_raw_frame_buffers(VP8_COMP *cpi)
#if VP8_TEMPORAL_ALT_REF
if (vp8_yv12_alloc_frame_buffer(&cpi->alt_ref_buffer,
- width, height, 16))
+ width, height, VP8BORDERINPIXELS))
vpx_internal_error(&cpi->common.error, VPX_CODEC_MEM_ERROR,
"Failed to allocate altref buffer");
@@ -1290,7 +1294,8 @@ void vp8_alloc_compressor_data(VP8_COMP *cpi)
vpx_internal_error(&cpi->common.error, VPX_CODEC_MEM_ERROR,
"Failed to allocate last frame buffer");
- if (vp8_yv12_alloc_frame_buffer(&cpi->scaled_source, width, height, 16))
+ if (vp8_yv12_alloc_frame_buffer(&cpi->scaled_source,
+ width, height, VP8BORDERINPIXELS))
vpx_internal_error(&cpi->common.error, VPX_CODEC_MEM_ERROR,
"Failed to allocate scaled source buffer");
diff --git a/vp8/vp8_cx_iface.c b/vp8/vp8_cx_iface.c
index 966355da1..8fcee81b4 100644
--- a/vp8/vp8_cx_iface.c
+++ b/vp8/vp8_cx_iface.c
@@ -806,14 +806,17 @@ static vpx_codec_err_t vp8e_encode(vpx_codec_alg_priv_t *ctx,
int i;
const int num_partitions =
(1 << cpi->common.multi_token_partition) + 1;
+
+ pkt.data.frame.flags |= VPX_FRAME_IS_FRAGMENT;
+
for (i = 0; i < num_partitions; ++i)
{
pkt.data.frame.buf = cx_data;
pkt.data.frame.sz = cpi->partition_sz[i];
pkt.data.frame.partition_id = i;
/* don't set the fragment bit for the last partition */
- if (i < num_partitions - 1)
- pkt.data.frame.flags |= VPX_FRAME_IS_FRAGMENT;
+ if (i == (num_partitions - 1))
+ pkt.data.frame.flags &= ~VPX_FRAME_IS_FRAGMENT;
vpx_codec_pkt_list_add(&ctx->pkt_list.head, &pkt);
cx_data += cpi->partition_sz[i];
cx_data_sz -= cpi->partition_sz[i];
diff --git a/vp8/vp8_dx_iface.c b/vp8/vp8_dx_iface.c
index 58dc486de..13a072bff 100644
--- a/vp8/vp8_dx_iface.c
+++ b/vp8/vp8_dx_iface.c
@@ -301,6 +301,36 @@ update_error_state(vpx_codec_alg_priv_t *ctx,
return res;
}
+static void yuvconfig2image(vpx_image_t *img,
+ const YV12_BUFFER_CONFIG *yv12,
+ void *user_priv)
+{
+ /** vpx_img_wrap() doesn't allow specifying independent strides for
+ * the Y, U, and V planes, nor other alignment adjustments that
+ * might be representable by a YV12_BUFFER_CONFIG, so we just
+ * initialize all the fields.*/
+ img->fmt = yv12->clrtype == REG_YUV ?
+ VPX_IMG_FMT_I420 : VPX_IMG_FMT_VPXI420;
+ img->w = yv12->y_stride;
+ img->h = (yv12->y_height + 2 * VP8BORDERINPIXELS + 15) & ~15;
+ img->d_w = yv12->y_width;
+ img->d_h = yv12->y_height;
+ img->x_chroma_shift = 1;
+ img->y_chroma_shift = 1;
+ img->planes[VPX_PLANE_Y] = yv12->y_buffer;
+ img->planes[VPX_PLANE_U] = yv12->u_buffer;
+ img->planes[VPX_PLANE_V] = yv12->v_buffer;
+ img->planes[VPX_PLANE_ALPHA] = NULL;
+ img->stride[VPX_PLANE_Y] = yv12->y_stride;
+ img->stride[VPX_PLANE_U] = yv12->uv_stride;
+ img->stride[VPX_PLANE_V] = yv12->uv_stride;
+ img->stride[VPX_PLANE_ALPHA] = yv12->y_stride;
+ img->bps = 12;
+ img->user_priv = user_priv;
+ img->img_data = yv12->buffer_alloc;
+ img->img_data_owner = 0;
+ img->self_allocd = 0;
+}
static vpx_codec_err_t vp8_decode(vpx_codec_alg_priv_t *ctx,
const uint8_t *data,
@@ -429,21 +459,8 @@ static vpx_codec_err_t vp8_decode(vpx_codec_alg_priv_t *ctx,
if (!res && 0 == vp8dx_get_raw_frame(ctx->pbi, &sd, &time_stamp, &time_end_stamp, &flags))
{
- /* Align width/height */
- unsigned int a_w = (sd.y_width + 15) & ~15;
- unsigned int a_h = (sd.y_height + 15) & ~15;
-
- vpx_img_wrap(&ctx->img, VPX_IMG_FMT_I420,
- a_w + 2 * VP8BORDERINPIXELS,
- a_h + 2 * VP8BORDERINPIXELS,
- 1,
- sd.buffer_alloc);
- vpx_img_set_rect(&ctx->img,
- VP8BORDERINPIXELS, VP8BORDERINPIXELS,
- sd.y_width, sd.y_height);
- ctx->img.user_priv = user_priv;
+ yuvconfig2image(&ctx->img, &sd, user_priv);
ctx->img_avail = 1;
-
}
}
diff --git a/vpx/internal/vpx_codec_internal.h b/vpx/internal/vpx_codec_internal.h
index 7cc2c3a62..a1ff1921e 100644
--- a/vpx/internal/vpx_codec_internal.h
+++ b/vpx/internal/vpx_codec_internal.h
@@ -45,7 +45,6 @@
#define VPX_CODEC_INTERNAL_H
#include "../vpx_decoder.h"
#include "../vpx_encoder.h"
-#include "vpx_config.h"
#include <stdarg.h>
@@ -436,23 +435,6 @@ vpx_codec_pkt_list_get(struct vpx_codec_pkt_list *list,
#include <stdio.h>
#include <setjmp.h>
-
-/* GLIBC started intercepting calls to longjmp in version 2.11, if the
- * FORTIFY_SOURCE flag is defined (it's defined by default on Ubuntu).
- * This can cause problems running under older versions of GLIBC (ie,
- * for binary distributions), so work around it by linking to the
- * underlying longjmp call directly.
- */
-#if defined(__GNUC_PREREQ)
-#if __GNUC_PREREQ (2,11)
-#if ARCH_X86_64
-__asm__(".symver __longjmp_chk,longjmp@GLIBC_2.2.5");
-#else
-__asm__(".symver __longjmp_chk,longjmp@GLIBC_2.0");
-#endif
-#endif
-#endif
-
struct vpx_internal_error_info
{
vpx_codec_err_t error_code;
diff --git a/vpx_scale/generic/yv12config.c b/vpx_scale/generic/yv12config.c
index d02cde28f..eff594e2d 100644
--- a/vpx_scale/generic/yv12config.c
+++ b/vpx_scale/generic/yv12config.c
@@ -49,25 +49,33 @@ vp8_yv12_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height, int
if (ybf)
{
+ int y_stride = ((width + 2 * border) + 31) & ~31;
+ int yplane_size = (height + 2 * border) * y_stride;
int uv_width = width >> 1;
int uv_height = height >> 1;
- int yplane_size = (height + 2 * border) * (width + 2 * border);
- int uvplane_size = (uv_height + border) * (uv_width + border);
+ /** There is currently a bunch of code which assumes
+ * uv_stride == y_stride/2, so enforce this here. */
+ int uv_stride = y_stride >> 1;
+ int uvplane_size = (uv_height + border) * uv_stride;
vp8_yv12_de_alloc_frame_buffer(ybf);
- /* only support allocating buffers that have
- a height and width that are multiples of 16 */
- if ((width & 0xf) | (height & 0xf))
+ /** Only support allocating buffers that have a height and width that
+ * are multiples of 16, and a border that's a multiple of 32.
+ * The border restriction is required to get 16-byte alignment of the
+ * start of the chroma rows without intoducing an arbitrary gap
+ * between planes, which would break the semantics of things like
+ * vpx_img_set_rect(). */
+ if ((width & 0xf) | (height & 0xf) | (border & 0x1f))
return -3;
ybf->y_width = width;
ybf->y_height = height;
- ybf->y_stride = width + 2 * border;
+ ybf->y_stride = y_stride;
ybf->uv_width = uv_width;
ybf->uv_height = uv_height;
- ybf->uv_stride = uv_width + border;
+ ybf->uv_stride = uv_stride;
ybf->border = border;
ybf->frame_size = yplane_size + 2 * uvplane_size;
@@ -77,9 +85,9 @@ vp8_yv12_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height, int
if (ybf->buffer_alloc == NULL)
return -1;
- ybf->y_buffer = ybf->buffer_alloc + (border * ybf->y_stride) + border;
- ybf->u_buffer = ybf->buffer_alloc + yplane_size + (border / 2 * ybf->uv_stride) + border / 2;
- ybf->v_buffer = ybf->buffer_alloc + yplane_size + uvplane_size + (border / 2 * ybf->uv_stride) + border / 2;
+ ybf->y_buffer = ybf->buffer_alloc + (border * y_stride) + border;
+ ybf->u_buffer = ybf->buffer_alloc + yplane_size + (border / 2 * uv_stride) + border / 2;
+ ybf->v_buffer = ybf->buffer_alloc + yplane_size + uvplane_size + (border / 2 * uv_stride) + border / 2;
ybf->corrupted = 0; /* assume not currupted by errors */
}