summaryrefslogtreecommitdiff
path: root/vp8
diff options
context:
space:
mode:
authorScott LaVarnway <slavarnway@google.com>2013-01-29 10:34:35 -0800
committerScott LaVarnway <slavarnway@google.com>2013-01-29 10:34:35 -0800
commit2146c68dfd81a35c469582bd6874b86b18ddde8e (patch)
tree7a5e8a1c1d63a4cd2a232e4e92d7a1a39a558202 /vp8
parente893af1283e996ca356a7f99932aa558bdef6c1e (diff)
downloadlibvpx-2146c68dfd81a35c469582bd6874b86b18ddde8e.tar
libvpx-2146c68dfd81a35c469582bd6874b86b18ddde8e.tar.gz
libvpx-2146c68dfd81a35c469582bd6874b86b18ddde8e.tar.bz2
libvpx-2146c68dfd81a35c469582bd6874b86b18ddde8e.zip
Use FRAGMENT_DATA struct in pbi
for fragment information. Change-Id: Idc83625591a1e4ca6f551dcfb7fc0428f6f37351
Diffstat (limited to 'vp8')
-rw-r--r--vp8/decoder/decodframe.c38
-rw-r--r--vp8/decoder/onyxd_if.c2
-rw-r--r--vp8/decoder/onyxd_int.h6
-rw-r--r--vp8/vp8_dx_iface.c8
4 files changed, 22 insertions, 32 deletions
diff --git a/vp8/decoder/decodframe.c b/vp8/decoder/decodframe.c
index 463211810..6f8282a64 100644
--- a/vp8/decoder/decodframe.c
+++ b/vp8/decoder/decodframe.c
@@ -828,8 +828,8 @@ static void setup_token_decoder(VP8D_COMP *pbi,
unsigned int partition_idx;
unsigned int fragment_idx;
unsigned int num_token_partitions;
- const unsigned char *first_fragment_end = pbi->fragments[0] +
- pbi->fragment_sizes[0];
+ const unsigned char *first_fragment_end = pbi->fragments.ptrs[0] +
+ pbi->fragments.sizes[0];
TOKEN_PARTITION multi_token_partition =
(TOKEN_PARTITION)vp8_read_literal(&pbi->mbc[8], 2);
@@ -839,10 +839,10 @@ static void setup_token_decoder(VP8D_COMP *pbi,
/* Check for partitions within the fragments and unpack the fragments
* so that each fragment pointer points to its corresponding partition. */
- for (fragment_idx = 0; fragment_idx < pbi->num_fragments; ++fragment_idx)
+ for (fragment_idx = 0; fragment_idx < pbi->fragments.count; ++fragment_idx)
{
- unsigned int fragment_size = pbi->fragment_sizes[fragment_idx];
- const unsigned char *fragment_end = pbi->fragments[fragment_idx] +
+ unsigned int fragment_size = pbi->fragments.sizes[fragment_idx];
+ const unsigned char *fragment_end = pbi->fragments.ptrs[fragment_idx] +
fragment_size;
/* Special case for handling the first partition since we have already
* read its size. */
@@ -850,16 +850,16 @@ static void setup_token_decoder(VP8D_COMP *pbi,
{
/* Size of first partition + token partition sizes element */
ptrdiff_t ext_first_part_size = token_part_sizes -
- pbi->fragments[0] + 3 * (num_token_partitions - 1);
+ pbi->fragments.ptrs[0] + 3 * (num_token_partitions - 1);
fragment_size -= (unsigned int)ext_first_part_size;
if (fragment_size > 0)
{
- pbi->fragment_sizes[0] = (unsigned int)ext_first_part_size;
+ pbi->fragments.sizes[0] = (unsigned int)ext_first_part_size;
/* The fragment contains an additional partition. Move to
* next. */
fragment_idx++;
- pbi->fragments[fragment_idx] = pbi->fragments[0] +
- pbi->fragment_sizes[0];
+ pbi->fragments.ptrs[fragment_idx] = pbi->fragments.ptrs[0] +
+ pbi->fragments.sizes[0];
}
}
/* Split the chunk into partitions read from the bitstream */
@@ -868,12 +868,12 @@ static void setup_token_decoder(VP8D_COMP *pbi,
ptrdiff_t partition_size = read_available_partition_size(
pbi,
token_part_sizes,
- pbi->fragments[fragment_idx],
+ pbi->fragments.ptrs[fragment_idx],
first_fragment_end,
fragment_end,
fragment_idx - 1,
num_token_partitions);
- pbi->fragment_sizes[fragment_idx] = (unsigned int)partition_size;
+ pbi->fragments.sizes[fragment_idx] = (unsigned int)partition_size;
fragment_size -= (unsigned int)partition_size;
assert(fragment_idx <= num_token_partitions);
if (fragment_size > 0)
@@ -881,19 +881,19 @@ static void setup_token_decoder(VP8D_COMP *pbi,
/* The fragment contains an additional partition.
* Move to next. */
fragment_idx++;
- pbi->fragments[fragment_idx] =
- pbi->fragments[fragment_idx - 1] + partition_size;
+ pbi->fragments.ptrs[fragment_idx] =
+ pbi->fragments.ptrs[fragment_idx - 1] + partition_size;
}
}
}
- pbi->num_fragments = num_token_partitions + 1;
+ pbi->fragments.count = num_token_partitions + 1;
- for (partition_idx = 1; partition_idx < pbi->num_fragments; ++partition_idx)
+ for (partition_idx = 1; partition_idx < pbi->fragments.count; ++partition_idx)
{
if (vp8dx_start_decode(bool_decoder,
- pbi->fragments[partition_idx],
- pbi->fragment_sizes[partition_idx]))
+ pbi->fragments.ptrs[partition_idx],
+ pbi->fragments.sizes[partition_idx]))
vpx_internal_error(&pbi->common.error, VPX_CODEC_MEM_ERROR,
"Failed to allocate bool decoder %d",
partition_idx);
@@ -983,8 +983,8 @@ int vp8_decode_frame(VP8D_COMP *pbi)
vp8_reader *const bc = & pbi->mbc[8];
VP8_COMMON *const pc = & pbi->common;
MACROBLOCKD *const xd = & pbi->mb;
- const unsigned char *data = pbi->fragments[0];
- const unsigned char *data_end = data + pbi->fragment_sizes[0];
+ const unsigned char *data = pbi->fragments.ptrs[0];
+ const unsigned char *data_end = data + pbi->fragments.sizes[0];
ptrdiff_t first_partition_length_in_bytes;
int i, j, k, l;
diff --git a/vp8/decoder/onyxd_if.c b/vp8/decoder/onyxd_if.c
index cb51c2b02..6f473de20 100644
--- a/vp8/decoder/onyxd_if.c
+++ b/vp8/decoder/onyxd_if.c
@@ -282,7 +282,7 @@ static int swap_frame_buffers (VP8_COMMON *cm)
int check_fragments_for_errors(VP8D_COMP *pbi)
{
if (!pbi->ec_active &&
- pbi->num_fragments <= 1 && pbi->fragment_sizes[0] == 0)
+ pbi->fragments.count <= 1 && pbi->fragments.sizes[0] == 0)
{
VP8_COMMON *cm = &pbi->common;
diff --git a/vp8/decoder/onyxd_int.h b/vp8/decoder/onyxd_int.h
index ff9ef0e46..290c21217 100644
--- a/vp8/decoder/onyxd_int.h
+++ b/vp8/decoder/onyxd_int.h
@@ -54,10 +54,7 @@ typedef struct VP8D_COMP
VP8D_CONFIG oxcf;
-
- const unsigned char *fragments[MAX_PARTITIONS];
- unsigned int fragment_sizes[MAX_PARTITIONS];
- unsigned int num_fragments;
+ FRAGMENT_DATA fragments;
#if CONFIG_MULTITHREAD
/* variable for threading */
@@ -103,7 +100,6 @@ typedef struct VP8D_COMP
#endif
int ec_enabled;
int ec_active;
- int input_fragments;
int decoded_key_frame;
int independent_partitions;
int frame_corrupt_residual;
diff --git a/vp8/vp8_dx_iface.c b/vp8/vp8_dx_iface.c
index 51fb74af2..598abbd29 100644
--- a/vp8/vp8_dx_iface.c
+++ b/vp8/vp8_dx_iface.c
@@ -598,13 +598,7 @@ static vpx_codec_err_t vp8_decode(vpx_codec_alg_priv_t *ctx,
}
/* update the pbi fragment data */
- ctx->pbi->num_fragments = ctx->fragments.count;
- ctx->pbi->input_fragments = ctx->fragments.enabled;
- vpx_memcpy(ctx->pbi->fragments, ctx->fragments.ptrs,
- sizeof(ctx->fragments.ptrs));
- vpx_memcpy(ctx->pbi->fragment_sizes, ctx->fragments.sizes,
- sizeof(ctx->fragments.sizes));
-
+ ctx->pbi->fragments = ctx->fragments;
ctx->user_priv = user_priv;
if (vp8dx_receive_compressed_data(ctx->pbi, data_sz, data, deadline))