Commit 49a76560 authored by David Barker's avatar David Barker Committed by Yaowu Xu

Fix segfault for reference-buffer&aom-highbitdepth

The commit fixes the segfault shown in  test AV1/ActiveMapTestLarge
when build with the following config:
../../aom/configure --disable-install-docs --enable-unit-tests
--enable-debug --disable-optimizations --enable-aom-highbitdepth
--enable-experimental --enable-ans --enable-bidir-pred
--enable-dual-filter --enable-entropy --enable-ext-inter
--enable-ext-interp --enable-ext-intra --enable-ext-partition
--enable-ext-partition-types --enable-ext-refs --enable-ext-tx
--enable-loop-restoration --enable-filter-intra --enable-motion-var
--enable-new-quant --enable-ref-mv --enable-supertx --enable-var-tx

BUG=aomedia:99

Change-Id: I900d5e1d5458c482a1f0a3dde769c1ad93acdca7
parent 1ee98b6c
......@@ -4655,15 +4655,20 @@ static void encode_frame_to_data_rate(AV1_COMP *cpi, size_t *size,
{
/* Non-normative definition of current_frame_id ("frame counter" with
* wraparound) */
int FidLen = FRAME_ID_LENGTH_MINUS7 + 7;
const int FidLen = FRAME_ID_LENGTH_MINUS7 + 7;
if (cm->current_frame_id == -1) {
int lsb, msb;
/* quasi-random initialization of current_frame_id for a key frame */
#if CONFIG_AOM_HIGHBITDEPTH
int lsb = CONVERT_TO_SHORTPTR(cpi->Source->y_buffer)[0] & 0xff;
int msb = CONVERT_TO_SHORTPTR(cpi->Source->y_buffer)[1] & 0xff;
#else
int lsb = cpi->Source->y_buffer[0];
int msb = cpi->Source->y_buffer[1];
if (cpi->Source->flags & YV12_FLAG_HIGHBITDEPTH) {
lsb = CONVERT_TO_SHORTPTR(cpi->Source->y_buffer)[0] & 0xff;
msb = CONVERT_TO_SHORTPTR(cpi->Source->y_buffer)[1] & 0xff;
} else {
#endif
lsb = cpi->Source->y_buffer[0] & 0xff;
msb = cpi->Source->y_buffer[1] & 0xff;
#if CONFIG_AOM_HIGHBITDEPTH
}
#endif
cm->current_frame_id = ((msb << 8) + lsb) % (1 << FidLen);
} else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment