diff options
author | Emeric Grange <emeric.grange@gmail.com> | 2012-01-13 13:53:20 +0100 |
---|---|---|
committer | Emeric Grange <emeric.grange@gmail.com> | 2012-06-24 16:57:32 +0200 |
commit | 2a3aa7ac0fbde5c9a3fe20d0ff29b680107f0660 (patch) | |
tree | 81c6a1878980c4c3dc2f8b8670ce0af7dafec927 | |
parent | 806b9dc304325d49ef391ca0e28e84abf6230256 (diff) |
g3dvl: vp8 software decoder cleanup
Signed-off-by: Emeric Grange <emeric.grange@gmail.com>
-rw-r--r-- | src/gallium/auxiliary/Makefile.sources | 1 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vp8/common/entropymode.h | 2 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vp8/common/findnearmv.c | 13 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vp8/common/findnearmv.h | 8 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vp8/common/mbpitch.c | 7 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vp8/common/modecontext.c | 48 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vp8/common/reconintra.c | 20 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vp8/common/reconintra.h | 5 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vp8/common/setupintrarecon.c | 31 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vp8/common/setupintrarecon.h | 18 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vp8/common/treecoder.h | 8 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vp8/decoder/decodeframe.c | 42 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vp8/decoder/decodemv.c | 28 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vp8/decoder/onyxd_if.c | 4 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vp8/vp8_mem.c | 31 |
15 files changed, 105 insertions, 161 deletions
diff --git a/src/gallium/auxiliary/Makefile.sources b/src/gallium/auxiliary/Makefile.sources index 36ca41694b..d5e0dc7948 100644 --- a/src/gallium/auxiliary/Makefile.sources +++ b/src/gallium/auxiliary/Makefile.sources @@ -171,7 +171,6 @@ C_SOURCES := \ vl/vp8/common/reconinter.c \ vl/vp8/common/reconintra.c \ vl/vp8/common/reconintra4x4.c \ - vl/vp8/common/setupintrarecon.c \ vl/vp8/common/treecoder.c \ vl/vp8/common/yv12utils.c \ vl/vp8/decoder/dboolhuff.c \ diff --git a/src/gallium/auxiliary/vl/vp8/common/entropymode.h b/src/gallium/auxiliary/vl/vp8/common/entropymode.h index 8f3b01ab41..927231688d 100644 --- a/src/gallium/auxiliary/vl/vp8/common/entropymode.h +++ b/src/gallium/auxiliary/vl/vp8/common/entropymode.h @@ -60,7 +60,7 @@ extern const vp8_tree_index vp8_small_mvtree[]; extern struct vp8_token_struct vp8_small_mvencodings [8]; -void vp8_entropy_mode_init(void); +void vp8_entropy_mode_init(); void vp8_init_mbmode_probs(VP8_COMMON *x); diff --git a/src/gallium/auxiliary/vl/vp8/common/findnearmv.c b/src/gallium/auxiliary/vl/vp8/common/findnearmv.c index 8c8a33b2e8..26ac79e547 100644 --- a/src/gallium/auxiliary/vl/vp8/common/findnearmv.c +++ b/src/gallium/auxiliary/vl/vp8/common/findnearmv.c @@ -11,13 +11,6 @@ #include "findnearmv.h" -const unsigned char vp8_mbsplit_offset[4][16] = { - { 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - { 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - { 0, 2, 8, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15} -}; - /** * Predict motion vectors using those from already-decoded nearby blocks. * Note that we only consider one 4x4 subblock from each candidate 16x16 @@ -109,9 +102,8 @@ void vp8_find_near_mvs(MACROBLOCKD *xd, cnt[CNT_NEAREST] += 1; } - cnt[CNT_SPLITMV] = ((above->mbmi.mode == SPLITMV) - + (left->mbmi.mode == SPLITMV)) * 2 - + (aboveleft->mbmi.mode == SPLITMV); + cnt[CNT_SPLITMV] = ((above->mbmi.mode == SPLITMV) + (left->mbmi.mode == SPLITMV)) * 2 + + (aboveleft->mbmi.mode == SPLITMV); /* Swap near and nearest if necessary */ if (cnt[CNT_NEAR] > cnt[CNT_NEAREST]) @@ -149,4 +141,3 @@ vp8_prob *vp8_mv_ref_probs(vp8_prob p[VP8_MVREFS-1], const int near_mv_ref_ct[4] /*p[3] = vp8_mode_contexts [near_mv_ref_ct[1] + near_mv_ref_ct[2] + near_mv_ref_ct[3]] [3];*/ return p; } - diff --git a/src/gallium/auxiliary/vl/vp8/common/findnearmv.h b/src/gallium/auxiliary/vl/vp8/common/findnearmv.h index f795cee3b3..a866969b27 100644 --- a/src/gallium/auxiliary/vl/vp8/common/findnearmv.h +++ b/src/gallium/auxiliary/vl/vp8/common/findnearmv.h @@ -73,7 +73,6 @@ static unsigned int vp8_check_mv_bounds(int_mv *mv, int mb_to_left_edge, return need_to_clamp; } - void vp8_find_near_mvs(MACROBLOCKD *xd, const MODE_INFO *here, int_mv *nearest, int_mv *nearby, int_mv *best, @@ -81,11 +80,7 @@ void vp8_find_near_mvs(MACROBLOCKD *xd, int refframe, int *ref_frame_sign_bias); -vp8_prob *vp8_mv_ref_probs(vp8_prob p[VP8_MVREFS-1], - const int near_mv_ref_ct[4]); - -extern const unsigned char vp8_mbsplit_offset[4][16]; - +vp8_prob *vp8_mv_ref_probs(vp8_prob p[VP8_MVREFS-1], const int near_mv_ref_ct[4]); static int left_block_mv(const MODE_INFO *cur_mb, int b) { @@ -123,6 +118,7 @@ static B_PREDICTION_MODE left_block_mode(const MODE_INFO *cur_mb, int b) { /* On L edge, get from MB to left of us */ --cur_mb; + switch (cur_mb->mbmi.mode) { case B_PRED: diff --git a/src/gallium/auxiliary/vl/vp8/common/mbpitch.c b/src/gallium/auxiliary/vl/vp8/common/mbpitch.c index fc405fc527..237176508b 100644 --- a/src/gallium/auxiliary/vl/vp8/common/mbpitch.c +++ b/src/gallium/auxiliary/vl/vp8/common/mbpitch.c @@ -20,19 +20,19 @@ typedef enum static void setup_block(BLOCKD *b, int mv_stride, unsigned char **base, - int Stride, + int stride, int offset, BLOCKSET bs) { if (bs == DEST) { - b->dst_stride = Stride; + b->dst_stride = stride; b->dst = offset; b->base_dst = base; } else { - b->pre_stride = Stride; + b->pre_stride = stride; b->pre = offset; b->base_pre = base; } @@ -41,7 +41,6 @@ static void setup_block(BLOCKD *b, static void setup_macroblock(MACROBLOCKD *x, BLOCKSET bs) { int block; - unsigned char **y, **u, **v; if (bs == DEST) diff --git a/src/gallium/auxiliary/vl/vp8/common/modecontext.c b/src/gallium/auxiliary/vl/vp8/common/modecontext.c index 85657b6455..68d6577dd1 100644 --- a/src/gallium/auxiliary/vl/vp8/common/modecontext.c +++ b/src/gallium/auxiliary/vl/vp8/common/modecontext.c @@ -12,36 +12,29 @@ const int vp8_mode_contexts[6][4] = { - { - /* 0 */ + { /* 0 */ 7, 1, 1, 143, }, - { - /* 1 */ + { /* 1 */ 14, 18, 14, 107, }, - { - /* 2 */ + { /* 2 */ 135, 64, 57, 68, }, - { - /* 3 */ + { /* 3 */ 60, 56, 128, 65, }, - { - /* 4 */ + { /* 4 */ 159, 134, 128, 34, }, - { - /* 5 */ + { /* 5 */ 234, 188, 128, 28, }, }; const unsigned int vp8_kf_default_bmode_counts [VP8_BINTRAMODES] [VP8_BINTRAMODES] [VP8_BINTRAMODES] = { - { - /*Above Mode : 0*/ + { /* Above Mode : 0 */ { 43438, 2195, 470, 316, 615, 171, 217, 412, 124, 160, }, /* left_mode 0 */ { 5722, 2751, 296, 291, 81, 68, 80, 101, 100, 170, }, /* left_mode 1 */ { 1629, 201, 307, 25, 47, 16, 34, 72, 19, 28, }, /* left_mode 2 */ @@ -53,8 +46,7 @@ const unsigned int vp8_kf_default_bmode_counts [VP8_BINTRAMODES] [VP8_BINTRAMODE { 230, 54, 20, 124, 16, 125, 29, 12, 283, 37, }, /* left_mode 8 */ { 260, 87, 21, 120, 32, 16, 33, 16, 33, 203, }, /* left_mode 9 */ }, - { - /*Above Mode : 1*/ + { /* Above Mode : 1 */ { 3934, 2573, 355, 137, 128, 87, 133, 117, 37, 27, }, /* left_mode 0 */ { 1036, 1929, 278, 135, 27, 37, 48, 55, 41, 91, }, /* left_mode 1 */ { 223, 256, 253, 15, 13, 9, 28, 64, 3, 3, }, /* left_mode 2 */ @@ -66,8 +58,7 @@ const unsigned int vp8_kf_default_bmode_counts [VP8_BINTRAMODES] [VP8_BINTRAMODE { 48, 34, 10, 52, 8, 15, 6, 6, 63, 20, }, /* left_mode 8 */ { 96, 48, 22, 63, 11, 14, 5, 8, 9, 96, }, /* left_mode 9 */ }, - { - /*Above Mode : 2*/ + { /* Above Mode : 2 */ { 709, 461, 506, 36, 27, 33, 151, 98, 24, 6, }, /* left_mode 0 */ { 201, 375, 442, 27, 13, 8, 46, 58, 6, 19, }, /* left_mode 1 */ { 122, 140, 417, 4, 13, 3, 33, 59, 4, 2, }, /* left_mode 2 */ @@ -79,8 +70,7 @@ const unsigned int vp8_kf_default_bmode_counts [VP8_BINTRAMODES] [VP8_BINTRAMODE { 14, 7, 7, 16, 3, 11, 4, 13, 15, 16, }, /* left_mode 8 */ { 36, 8, 32, 9, 9, 4, 14, 7, 6, 24, }, /* left_mode 9 */ }, - { - /*Above Mode : 3*/ + { /* Above Mode : 3 */ { 1340, 173, 36, 119, 30, 10, 13, 10, 20, 26, }, /* left_mode 0 */ { 156, 293, 26, 108, 5, 16, 2, 4, 23, 30, }, /* left_mode 1 */ { 60, 34, 13, 7, 3, 3, 0, 8, 4, 5, }, /* left_mode 2 */ @@ -92,8 +82,7 @@ const unsigned int vp8_kf_default_bmode_counts [VP8_BINTRAMODES] [VP8_BINTRAMODE { 23, 19, 2, 33, 1, 5, 2, 0, 51, 8, }, /* left_mode 8 */ { 33, 26, 7, 53, 3, 9, 3, 3, 9, 19, }, /* left_mode 9 */ }, - { - /*Above Mode : 4*/ + { /* Above Mode : 4 */ { 410, 165, 43, 31, 66, 15, 30, 54, 8, 17, }, /* left_mode 0 */ { 115, 64, 27, 18, 30, 7, 11, 15, 4, 19, }, /* left_mode 1 */ { 31, 23, 25, 1, 7, 2, 2, 10, 0, 5, }, /* left_mode 2 */ @@ -105,8 +94,7 @@ const unsigned int vp8_kf_default_bmode_counts [VP8_BINTRAMODES] [VP8_BINTRAMODE { 8, 2, 1, 4, 2, 5, 1, 1, 2, 10, }, /* left_mode 8 */ { 76, 7, 5, 7, 18, 2, 2, 0, 5, 45, }, /* left_mode 9 */ }, - { - /*Above Mode : 5*/ + { /* Above Mode : 5 */ { 444, 46, 47, 20, 14, 110, 60, 14, 60, 7, }, /* left_mode 0 */ { 59, 57, 25, 18, 3, 17, 21, 6, 14, 6, }, /* left_mode 1 */ { 24, 17, 20, 6, 4, 13, 7, 2, 3, 2, }, /* left_mode 2 */ @@ -118,8 +106,7 @@ const unsigned int vp8_kf_default_bmode_counts [VP8_BINTRAMODES] [VP8_BINTRAMODE { 15, 1, 3, 7, 3, 21, 7, 1, 34, 5, }, /* left_mode 8 */ { 18, 5, 1, 3, 4, 3, 7, 1, 2, 9, }, /* left_mode 9 */ }, - { - /*Above Mode : 6*/ + { /* Above Mode : 6 */ { 476, 149, 94, 13, 14, 77, 291, 27, 23, 3, }, /* left_mode 0 */ { 79, 83, 42, 14, 2, 12, 63, 2, 4, 14, }, /* left_mode 1 */ { 43, 36, 55, 1, 3, 8, 42, 11, 5, 1, }, /* left_mode 2 */ @@ -131,8 +118,7 @@ const unsigned int vp8_kf_default_bmode_counts [VP8_BINTRAMODES] [VP8_BINTRAMODE { 10, 3, 3, 3, 3, 8, 2, 2, 9, 3, }, /* left_mode 8 */ { 13, 7, 11, 4, 0, 4, 6, 2, 5, 8, }, /* left_mode 9 */ }, - { - /*Above Mode : 7*/ + { /* Above Mode : 7 */ { 376, 135, 119, 6, 32, 8, 31, 224, 9, 3, }, /* left_mode 0 */ { 93, 60, 54, 6, 13, 7, 8, 92, 2, 12, }, /* left_mode 1 */ { 74, 36, 84, 0, 3, 2, 9, 67, 2, 1, }, /* left_mode 2 */ @@ -144,8 +130,7 @@ const unsigned int vp8_kf_default_bmode_counts [VP8_BINTRAMODES] [VP8_BINTRAMODE { 9, 1, 2, 8, 3, 7, 0, 5, 3, 3, }, /* left_mode 8 */ { 20, 4, 5, 10, 4, 2, 7, 17, 3, 16, }, /* left_mode 9 */ }, - { - /*Above Mode : 8*/ + { /* Above Mode : 8 */ { 617, 68, 34, 79, 11, 27, 25, 14, 75, 13, }, /* left_mode 0 */ { 51, 82, 21, 26, 6, 12, 13, 1, 26, 16, }, /* left_mode 1 */ { 29, 9, 12, 11, 3, 7, 1, 10, 2, 2, }, /* left_mode 2 */ @@ -157,8 +142,7 @@ const unsigned int vp8_kf_default_bmode_counts [VP8_BINTRAMODES] [VP8_BINTRAMODE { 14, 8, 5, 23, 2, 12, 6, 2, 117, 5, }, /* left_mode 8 */ { 9, 6, 2, 19, 1, 6, 3, 2, 9, 9, }, /* left_mode 9 */ }, - { - /*Above Mode : 9*/ + { /* Above Mode : 9 */ { 680, 73, 22, 38, 42, 5, 11, 9, 6, 28, }, /* left_mode 0 */ { 113, 112, 21, 22, 10, 2, 8, 4, 6, 42, }, /* left_mode 1 */ { 44, 20, 24, 6, 5, 4, 3, 3, 1, 2, }, /* left_mode 2 */ diff --git a/src/gallium/auxiliary/vl/vp8/common/reconintra.c b/src/gallium/auxiliary/vl/vp8/common/reconintra.c index 9c9d839d8f..914d7d4589 100644 --- a/src/gallium/auxiliary/vl/vp8/common/reconintra.c +++ b/src/gallium/auxiliary/vl/vp8/common/reconintra.c @@ -14,6 +14,26 @@ #include "../vp8_mem.h" /** + * Set up frame new frame for intra coded blocks. + */ +void vp8_setup_intra_recon(YV12_BUFFER_CONFIG *ybf) +{ + int i; + + memset(ybf->y_buffer - 1 - ybf->y_stride, 127, ybf->y_width + 5); + for (i = 0; i < ybf->y_height; i++) + ybf->y_buffer[ybf->y_stride *i - 1] = (unsigned char) 129; + + memset(ybf->u_buffer - 1 - ybf->uv_stride, 127, ybf->uv_width + 5); + for (i = 0; i < ybf->uv_height; i++) + ybf->u_buffer[ybf->uv_stride *i - 1] = (unsigned char) 129; + + memset(ybf->v_buffer - 1 - ybf->uv_stride, 127, ybf->uv_width + 5); + for (i = 0; i < ybf->uv_height; i++) + ybf->v_buffer[ybf->uv_stride *i - 1] = (unsigned char) 129; +} + +/** * For skip_recon_mb(), add vp8_build_intra_predictors_mby_s(MACROBLOCKD *x) * and vp8_build_intra_predictors_mbuv_s(MACROBLOCKD *x). */ diff --git a/src/gallium/auxiliary/vl/vp8/common/reconintra.h b/src/gallium/auxiliary/vl/vp8/common/reconintra.h index 6bcda0adc6..a5ffd79700 100644 --- a/src/gallium/auxiliary/vl/vp8/common/reconintra.h +++ b/src/gallium/auxiliary/vl/vp8/common/reconintra.h @@ -8,10 +8,11 @@ * be found in the AUTHORS file in the root of the source tree. */ - #ifndef RECONINTRA_H #define RECONINTRA_H -extern void init_intra_left_above_pixels(MACROBLOCKD *x); +#include "yv12utils.h" + +extern void vp8_setup_intra_recon(YV12_BUFFER_CONFIG *ybf); #endif /* RECONINTRA_H */ diff --git a/src/gallium/auxiliary/vl/vp8/common/setupintrarecon.c b/src/gallium/auxiliary/vl/vp8/common/setupintrarecon.c deleted file mode 100644 index 96c1ba8cf8..0000000000 --- a/src/gallium/auxiliary/vl/vp8/common/setupintrarecon.c +++ /dev/null @@ -1,31 +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. - */ - - -#include "setupintrarecon.h" -#include "../vp8_mem.h" - -void vp8_setup_intra_recon(YV12_BUFFER_CONFIG *ybf) -{ - int i; - - /* set up frame new frame for intra coded blocks */ - memset(ybf->y_buffer - 1 - ybf->y_stride, 127, ybf->y_width + 5); - for (i = 0; i < ybf->y_height; i++) - ybf->y_buffer[ybf->y_stride *i - 1] = (unsigned char) 129; - - memset(ybf->u_buffer - 1 - ybf->uv_stride, 127, ybf->uv_width + 5); - for (i = 0; i < ybf->uv_height; i++) - ybf->u_buffer[ybf->uv_stride *i - 1] = (unsigned char) 129; - - memset(ybf->v_buffer - 1 - ybf->uv_stride, 127, ybf->uv_width + 5); - for (i = 0; i < ybf->uv_height; i++) - ybf->v_buffer[ybf->uv_stride *i - 1] = (unsigned char) 129; -} diff --git a/src/gallium/auxiliary/vl/vp8/common/setupintrarecon.h b/src/gallium/auxiliary/vl/vp8/common/setupintrarecon.h deleted file mode 100644 index eb602250dd..0000000000 --- a/src/gallium/auxiliary/vl/vp8/common/setupintrarecon.h +++ /dev/null @@ -1,18 +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. - */ - -#ifndef SETUPINTRARECON_H -#define SETUPINTRARECON_H - -#include "yv12utils.h" - -extern void vp8_setup_intra_recon(YV12_BUFFER_CONFIG *ybf); - -#endif /* SETUPINTRARECON_H */ diff --git a/src/gallium/auxiliary/vl/vp8/common/treecoder.h b/src/gallium/auxiliary/vl/vp8/common/treecoder.h index 3f5cfab947..c16f7b0bce 100644 --- a/src/gallium/auxiliary/vl/vp8/common/treecoder.h +++ b/src/gallium/auxiliary/vl/vp8/common/treecoder.h @@ -57,11 +57,11 @@ void vp8_tokens_from_tree_offset(struct vp8_token_struct *, vp8_tree, int offset * probability updates. */ void vp8_tree_probs_from_distribution(int n, /* n = size of alphabet */ - vp8_token tok[ /* n */ ], + vp8_token tok[/* n */], vp8_tree tree, - vp8_prob probs[ /* n-1 */ ], - unsigned int branch_ct[ /* n-1 */ ] [2], - const unsigned int num_events[ /* n */ ], + vp8_prob probs[/* n-1 */], + unsigned int branch_ct[/* n-1 */][2], + const unsigned int num_events[/* n */], unsigned int Pfactor, int Round); diff --git a/src/gallium/auxiliary/vl/vp8/decoder/decodeframe.c b/src/gallium/auxiliary/vl/vp8/decoder/decodeframe.c index 822efe9e50..f5b8647207 100644 --- a/src/gallium/auxiliary/vl/vp8/decoder/decodeframe.c +++ b/src/gallium/auxiliary/vl/vp8/decoder/decodeframe.c @@ -21,7 +21,6 @@ #include "../common/entropymode.h" #include "../common/quant_common.h" #include "../common/yv12utils.h" -#include "../common/setupintrarecon.h" #include "decodemv.h" #include "../vp8_mem.h" @@ -74,8 +73,11 @@ void mb_init_dequantizer(VP8D_COMP *pbi, MACROBLOCKD *xd) #define RTCD_VTABLE(x) NULL -/* skip_recon_mb() is Modified: Instead of writing the result to predictor buffer and then copying it - * to dst buffer, we can write the result directly to dst buffer. This eliminates unnecessary copy. */ +/** + * skip_recon_mb() is Modified: Instead of writing the result to predictor + * buffer and then copying it to dst buffer, we can write the result directly + * to dst buffer. This eliminates unnecessary copy. + */ static void skip_recon_mb(VP8D_COMP *pbi, MACROBLOCKD *xd) { if (xd->mode_info_context->mbmi.ref_frame == INTRA_FRAME) @@ -91,17 +93,18 @@ static void skip_recon_mb(VP8D_COMP *pbi, MACROBLOCKD *xd) } } +/** + * If the MV points so far into the UMV border that no visible pixels + * are used for reconstruction, the subpel part of the MV can be + * discarded and the MV limited to 16 pixels with equivalent results. + * + * This limit kicks in at 19 pixels for the top and left edges, for + * the 16 pixels plus 3 taps right of the central pixel when subpel + * filtering. The bottom and right edges use 16 pixels plus 2 pixels + * left of the central pixel when filtering. + */ static void clamp_mv_to_umv_border(MV *mv, const MACROBLOCKD *xd) { - /* If the MV points so far into the UMV border that no visible pixels - * are used for reconstruction, the subpel part of the MV can be - * discarded and the MV limited to 16 pixels with equivalent results. - * - * This limit kicks in at 19 pixels for the top and left edges, for - * the 16 pixels plus 3 taps right of the central pixel when subpel - * filtering. The bottom and right edges use 16 pixels plus 2 pixels - * left of the central pixel when filtering. - */ if (mv->col < (xd->mb_to_left_edge - (19 << 3))) mv->col = xd->mb_to_left_edge - (16 << 3); else if (mv->col > xd->mb_to_right_edge + (18 << 3)) @@ -113,7 +116,10 @@ static void clamp_mv_to_umv_border(MV *mv, const MACROBLOCKD *xd) mv->row = xd->mb_to_bottom_edge + (16 << 3); } -/* A version of the above function for chroma block MVs.*/ +/** + * \note clamp_uvmv_to_umv_border() is a chroma block MVs version of the + * function clamp_mv_to_umv_border(). + */ static void clamp_uvmv_to_umv_border(MV *mv, const MACROBLOCKD *xd) { mv->col = (2*mv->col < (xd->mb_to_left_edge - (19 << 3))) ? (xd->mb_to_left_edge - (16 << 3)) >> 1 : mv->col; @@ -160,7 +166,9 @@ static int get_delta_q(BOOL_DECODER *bd, int prev, int *q_update) return ret_val; } -/* note the extension is only for the last row, for intra prediction purpose */ +/** + * \note The extension is only for the last row, for intra prediction purpose. + */ static void vp8_extend_mb_row(YV12_BUFFER_CONFIG *ybf, unsigned char *YPtr, unsigned char *UPtr, @@ -807,9 +815,9 @@ int vp8_frame_decode(VP8D_COMP *pbi, struct pipe_vp8_picture_desc *frame_header) /* printf("Decoder: Frame Decoded, Size Roughly:%d bytes \n", bc->pos+pbi->bc2.pos); */ /* If this was a kf or Gf note the Q used */ - if (pc->frame_type == KEY_FRAME - || pc->refresh_golden_frame - || pc->refresh_alt_ref_frame) + if (pc->frame_type == KEY_FRAME || + pc->refresh_golden_frame || + pc->refresh_alt_ref_frame) { pc->last_kf_gf_q = pc->base_qindex; } diff --git a/src/gallium/auxiliary/vl/vp8/decoder/decodemv.c b/src/gallium/auxiliary/vl/vp8/decoder/decodemv.c index 090a69850b..31f61b5dcb 100644 --- a/src/gallium/auxiliary/vl/vp8/decoder/decodemv.c +++ b/src/gallium/auxiliary/vl/vp8/decoder/decodemv.c @@ -49,7 +49,7 @@ static int vp8_read_uv_mode(BOOL_DECODER *bd, const vp8_prob *p) static void vp8_read_mb_features(BOOL_DECODER *bd, MB_MODE_INFO *mi, MACROBLOCKD *x) { - /* Is segmentation enabled */ + /* Is segmentation enabled. */ if (x->segmentation_enabled && x->update_mb_segmentation_map) { /* If so then read the segment id. */ @@ -69,8 +69,7 @@ static void vp8_kfread_modes(VP8D_COMP *pbi, MODE_INFO *m, int mb_row, int mb_co MB_PREDICTION_MODE y_mode; /* Read the Macroblock segmentation map if it is being updated explicitly this frame (reset to 0 above by default) - * By default on a key frame reset all MBs to segment 0 - */ + * By default on a key frame reset all MBs to segment 0 */ m->mbmi.segment_id = 0; if (pbi->mb.update_mb_segmentation_map) @@ -181,6 +180,7 @@ static B_PREDICTION_MODE sub_mv_ref(BOOL_DECODER *bd, const vp8_prob *p) } static const unsigned char mbsplit_fill_count[4] = {8, 8, 4, 1}; + static const unsigned char mbsplit_fill_offset[4][16] = { { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, @@ -189,6 +189,14 @@ static const unsigned char mbsplit_fill_offset[4][16] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15} }; +static const unsigned char mbsplit_offset[4][16] = +{ + { 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 2, 8, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15} +}; + static void mb_mode_mv_init(VP8D_COMP *pbi) { BOOL_DECODER *const bd = &pbi->bd; @@ -198,7 +206,7 @@ static void mb_mode_mv_init(VP8D_COMP *pbi) if (pbi->common.mb_no_coeff_skip) pbi->prob_skip_false = (vp8_prob)vp8_read_literal(bd, 8); - if(pbi->common.frame_type != KEY_FRAME) + if (pbi->common.frame_type != KEY_FRAME) { pbi->prob_intra = (vp8_prob)vp8_read_literal(bd, 8); pbi->prob_last = (vp8_prob)vp8_read_literal(bd, 8); @@ -207,7 +215,6 @@ static void mb_mode_mv_init(VP8D_COMP *pbi) if (vp8_read_bit(bd)) { int i = 0; - do { pbi->common.fc.ymode_prob[i] = (vp8_prob)vp8_read_literal(bd, 8); } @@ -217,7 +224,6 @@ static void mb_mode_mv_init(VP8D_COMP *pbi) if (vp8_read_bit(bd)) { int i = 0; - do { pbi->common.fc.uv_mode_prob[i] = (vp8_prob)vp8_read_literal(bd, 8); } @@ -247,6 +253,7 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi, mb_to_bottom_edge += RIGHT_BOTTOM_MARGIN; mbmi->need_to_clamp_mvs = 0; + /* Distance of Mb to the various image edges. * These specified to 8th pel as they are always compared to MV values that * are in 1/8th pel units */ @@ -298,7 +305,7 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi, int_mv blockmv; int k; /* First block in subset j */ int mv_contz; - k = vp8_mbsplit_offset[s][j]; + k = mbsplit_offset[s][j]; leftmv.as_int = left_block_mv(mi, k); abovemv.as_int = above_block_mv(mi, k, mis); @@ -334,11 +341,9 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi, /* Fill (uniform) modes, mvs of jth subset. * Must do it here because ensuing subsets can * refer back to us via "left" or "above". */ - const unsigned char *fill_offset; + const unsigned char *fill_offset = &mbsplit_fill_offset[s][(unsigned char)j * mbsplit_fill_count[s]]; unsigned int fill_count = mbsplit_fill_count[s]; - fill_offset = &mbsplit_fill_offset[s][(unsigned char)j * mbsplit_fill_count[s]]; - do { mi->bmi[*fill_offset].mv.as_int = blockmv.as_int; fill_offset++; @@ -399,8 +404,7 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi, if ((mbmi->mode = (MB_PREDICTION_MODE)vp8_read_ymode(bd, pbi->common.fc.ymode_prob)) == B_PRED) { int j = 0; - do - { + do { mi->bmi[j].as_mode = (B_PREDICTION_MODE)vp8_read_bmode(bd, pbi->common.fc.bmode_prob); } while (++j < 16); diff --git a/src/gallium/auxiliary/vl/vp8/decoder/onyxd_if.c b/src/gallium/auxiliary/vl/vp8/decoder/onyxd_if.c index 6136fea4ad..fba2071aa6 100644 --- a/src/gallium/auxiliary/vl/vp8/decoder/onyxd_if.c +++ b/src/gallium/auxiliary/vl/vp8/decoder/onyxd_if.c @@ -245,10 +245,6 @@ int vp8_decoder_getframe(VP8D_PTR ptr, ret = 0; } - else - { - ret = -1; - } return ret; } diff --git a/src/gallium/auxiliary/vl/vp8/vp8_mem.c b/src/gallium/auxiliary/vl/vp8/vp8_mem.c index 8166a6baa9..845c30163b 100644 --- a/src/gallium/auxiliary/vl/vp8/vp8_mem.c +++ b/src/gallium/auxiliary/vl/vp8/vp8_mem.c @@ -12,10 +12,8 @@ void *vpx_memalign(size_t align, size_t size) { - void *addr, - * x = NULL; - - addr = malloc(size + align - 1 + ADDRESS_STORAGE_SIZE); + void *addr = malloc(size + align - 1 + ADDRESS_STORAGE_SIZE); + void *x = NULL; if (addr) { @@ -34,9 +32,7 @@ void *vpx_malloc(size_t size) void *vpx_calloc(size_t num, size_t size) { - void *x; - - x = vpx_memalign(DEFAULT_ALIGNMENT, num * size); + void *x = vpx_memalign(DEFAULT_ALIGNMENT, num * size); if (x) memset(x, 0, num * size); @@ -44,19 +40,19 @@ void *vpx_calloc(size_t num, size_t size) return x; } +/** + * \note The realloc() function changes the size of the object pointed to by + * ptr to the size specified by size, and returns a pointer to the + * possibly moved block. The contents are unchanged up to the lesser + * of the new and old sizes. If ptr is null, realloc() behaves like + * malloc() for the specified size. If size is zero (0) and ptr is + * not a null pointer, the object pointed to is freed. + */ void *vpx_realloc(void *memblk, size_t size) { void *addr, *new_addr = NULL; int align = DEFAULT_ALIGNMENT; - /* - The realloc() function changes the size of the object pointed to by - ptr to the size specified by size, and returns a pointer to the - possibly moved block. The contents are unchanged up to the lesser - of the new and old sizes. If ptr is null, realloc() behaves like - malloc() for the specified size. If size is zero (0) and ptr is - not a null pointer, the object pointed to is freed. - */ if (!memblk) new_addr = vpx_malloc(size); else if (!size) @@ -71,9 +67,8 @@ void *vpx_realloc(void *memblk, size_t size) if (new_addr) { addr = new_addr; - new_addr = (void *)(((size_t) - ((unsigned char *)new_addr + ADDRESS_STORAGE_SIZE) + (align - 1)) & - (size_t) - align); + new_addr = (void *)(((size_t)((unsigned char *)new_addr + ADDRESS_STORAGE_SIZE) + (align - 1)) & (size_t) - align); + // save the actual malloc address ((size_t *)new_addr)[-1] = (size_t)addr; } |