summaryrefslogtreecommitdiff
path: root/vp8/vp8_dx_iface.c
diff options
context:
space:
mode:
authorJohn Koleszar <jkoleszar@google.com>2010-11-05 12:30:33 -0400
committerJohn Koleszar <jkoleszar@google.com>2010-11-05 12:30:33 -0400
commit7a590c902b9a77d9792d3a2497d28302eb0e0834 (patch)
treeb1f735eee5d5a6fbc633b11eecf90dc47f8d7e42 /vp8/vp8_dx_iface.c
parentf4020e2338a1786b1db0f67075ceb7d9c01be6a3 (diff)
parent5551ef0ef4fd3271330fa5a2fbdfe70d4d2a1d2e (diff)
downloadlibvpx-7a590c902b9a77d9792d3a2497d28302eb0e0834.tar
libvpx-7a590c902b9a77d9792d3a2497d28302eb0e0834.tar.gz
libvpx-7a590c902b9a77d9792d3a2497d28302eb0e0834.tar.bz2
libvpx-7a590c902b9a77d9792d3a2497d28302eb0e0834.zip
Merge remote branch 'origin/master' into experimental
Conflicts: configure ivfenc.c vp8/common/alloccommon.c vp8/common/onyxc_int.h vp8/vp8_cx_iface.c
Diffstat (limited to 'vp8/vp8_dx_iface.c')
-rw-r--r--vp8/vp8_dx_iface.c65
1 files changed, 39 insertions, 26 deletions
diff --git a/vp8/vp8_dx_iface.c b/vp8/vp8_dx_iface.c
index 19c59cd80..a85cad1b4 100644
--- a/vp8/vp8_dx_iface.c
+++ b/vp8/vp8_dx_iface.c
@@ -1,10 +1,11 @@
/*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
+ * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
*
- * Use of this source code is governed by a BSD-style license and patent
- * grant that can be found in the LICENSE file in the root of the source
- * tree. All contributing project authors may be found in the AUTHORS
- * file in the root of the source tree.
+ * 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.
*/
@@ -40,7 +41,7 @@ typedef enum
VP8_SEG_ALG_PRIV = 256,
VP8_SEG_MAX
} mem_seg_id_t;
-#define NELEMENTS(x) (sizeof(x)/sizeof(x[0]))
+#define NELEMENTS(x) ((int)(sizeof(x)/sizeof(x[0])))
static unsigned long vp8_priv_sz(const vpx_codec_dec_cfg_t *si, vpx_codec_flags_t);
@@ -169,7 +170,7 @@ static void vp8_init_ctx(vpx_codec_ctx_t *ctx, const vpx_codec_mmap_t *mmap)
}
}
-static void *mmap_lkup(vpx_codec_alg_priv_t *ctx, int id)
+static void *mmap_lkup(vpx_codec_alg_priv_t *ctx, unsigned int id)
{
int i;
@@ -195,9 +196,6 @@ static void vp8_finalize_mmaps(vpx_codec_alg_priv_t *ctx)
ctx->pbi->fb_storage_ptr[0] = mmap_lkup(ctx, VP6_SEG_IMG0_STRG);
ctx->pbi->fb_storage_ptr[1] = mmap_lkup(ctx, VP6_SEG_IMG1_STRG);
ctx->pbi->fb_storage_ptr[2] = mmap_lkup(ctx, VP6_SEG_IMG2_STRG);
- #if CONFIG_NEW_TOKENS
- ctx->pbi->token_graph = mmap_lkup(ctx, VP6_SEG_TOKEN_GRAPH);
- #endif
#if CONFIG_POSTPROC
ctx->pbi->postproc.deblock.fragment_variances = mmap_lkup(ctx, VP6_SEG_DEBLOCKER);
ctx->pbi->fb_storage_ptr[3] = mmap_lkup(ctx, VP6_SEG_PP_IMG_STRG);
@@ -225,11 +223,12 @@ static vpx_codec_err_t vp8_init(vpx_codec_ctx_t *ctx)
res = vp8_mmap_alloc(&mmap);
if (!res)
+ {
vp8_init_ctx(ctx, &mmap);
- ctx->priv->alg_priv->defer_alloc = 1;
- /*post processing level initialized to do nothing */
-
+ ctx->priv->alg_priv->defer_alloc = 1;
+ /*post processing level initialized to do nothing */
+ }
}
return res;
@@ -257,12 +256,12 @@ static vpx_codec_err_t vp8_peek_si(const uint8_t *data,
vpx_codec_err_t res = VPX_CODEC_OK;
{
- /*Parse from VP8 compressed data, the implies knowledge of the
- *VP8 bitsteam.
- * First 3 byte header including version, frame type and an offset
- * Next 3 bytes are image sizewith 12 bit each for width and height
+ /* Parse uncompresssed part of key frame header.
+ * 3 bytes:- including version, frame type and an offset
+ * 3 bytes:- sync code (0x9d, 0x01, 0x2a)
+ * 4 bytes:- including image width and height in the lowest 14 bits
+ * of each 2-byte value.
*/
-
si->is_kf = 0;
if (data_sz >= 10 && !(data[0] & 0x01)) /* I-Frame */
@@ -270,14 +269,14 @@ static vpx_codec_err_t vp8_peek_si(const uint8_t *data,
const uint8_t *c = data + 3;
si->is_kf = 1;
- // vet via sync code
+ /* vet via sync code */
if (c[0] != 0x9d || c[1] != 0x01 || c[2] != 0x2a)
res = VPX_CODEC_UNSUP_BITSTREAM;
si->w = swap2(*(const unsigned short *)(c + 3)) & 0x3fff;
si->h = swap2(*(const unsigned short *)(c + 5)) & 0x3fff;
- //printf("w=%d, h=%d\n", si->w, si->h);
+ /*printf("w=%d, h=%d\n", si->w, si->h);*/
if (!(si->h | si->w))
res = VPX_CODEC_UNSUP_BITSTREAM;
}
@@ -529,7 +528,7 @@ static vpx_codec_err_t vp8_xma_set_mmap(vpx_codec_ctx_t *ctx,
done = 1;
- if (ctx->priv->alg_priv)
+ if (!res && ctx->priv->alg_priv)
{
for (i = 0; i < NELEMENTS(vp8_mem_req_segs); i++)
{
@@ -654,9 +653,9 @@ vpx_codec_ctrl_fn_map_t vp8_ctf_maps[] =
#ifndef VERSION_STRING
#define VERSION_STRING
#endif
-vpx_codec_iface_t vpx_codec_vp8_dx_algo =
+CODEC_INTERFACE(vpx_codec_vp8_dx) =
{
- "vpx Technologies VP8 Decoder" VERSION_STRING,
+ "WebM Project VP8 Decoder" VERSION_STRING,
VPX_CODEC_INTERNAL_ABI_VERSION,
VPX_CODEC_CAP_DECODER | VP8_CAP_POSTPROC,
/* vpx_codec_caps_t caps; */
@@ -671,7 +670,14 @@ vpx_codec_iface_t vpx_codec_vp8_dx_algo =
vp8_decode, /* vpx_codec_decode_fn_t decode; */
vp8_get_frame, /* vpx_codec_frame_get_fn_t frame_get; */
},
- {NOT_IMPLEMENTED} /* encoder functions */
+ { /* encoder functions */
+ NOT_IMPLEMENTED,
+ NOT_IMPLEMENTED,
+ NOT_IMPLEMENTED,
+ NOT_IMPLEMENTED,
+ NOT_IMPLEMENTED,
+ NOT_IMPLEMENTED
+ }
};
/*
@@ -679,7 +685,7 @@ vpx_codec_iface_t vpx_codec_vp8_dx_algo =
*/
vpx_codec_iface_t vpx_codec_vp8_algo =
{
- "vpx Technologies VP8 Decoder (Deprecated API)" VERSION_STRING,
+ "WebM Project VP8 Decoder (Deprecated API)" VERSION_STRING,
VPX_CODEC_INTERNAL_ABI_VERSION,
VPX_CODEC_CAP_DECODER | VP8_CAP_POSTPROC,
/* vpx_codec_caps_t caps; */
@@ -694,5 +700,12 @@ vpx_codec_iface_t vpx_codec_vp8_algo =
vp8_decode, /* vpx_codec_decode_fn_t decode; */
vp8_get_frame, /* vpx_codec_frame_get_fn_t frame_get; */
},
- {NOT_IMPLEMENTED} /* encoder functions */
+ { /* encoder functions */
+ NOT_IMPLEMENTED,
+ NOT_IMPLEMENTED,
+ NOT_IMPLEMENTED,
+ NOT_IMPLEMENTED,
+ NOT_IMPLEMENTED,
+ NOT_IMPLEMENTED
+ }
};