fencepost
Change-Id: Ib0f988e11f80d3684d37119f457ca795f0ad16fa
This commit is contained in:
parent
911f6b036e
commit
5720143261
@ -9,7 +9,6 @@
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "vpx/vpx_encoder.h"
|
||||
@ -201,7 +200,7 @@ static void pack_mb_tokens_ans(struct AnsCoder *const ans,
|
||||
vpx_bit_depth_t bit_depth) {
|
||||
const TOKENEXTRA *p;
|
||||
|
||||
for (p = stop; p >= start; --p) {
|
||||
for (p = stop - 1; p >= start; --p) {
|
||||
const int t = p->token;
|
||||
//TODO: remove EOSB_TOKEN
|
||||
if (t != EOSB_TOKEN) {
|
||||
@ -227,8 +226,8 @@ static void pack_mb_tokens_ans(struct AnsCoder *const ans,
|
||||
// Write extra bits first
|
||||
if (b->base_val) {
|
||||
const int e = p->extra, l = b->len;
|
||||
rabs_write(ans, e & 1, 128);
|
||||
if (l) {
|
||||
rabs_write(ans, e & 1, 128);
|
||||
vp10_write_tree_r(ans, b->tree, b->prob, e >> 1, l, 0);
|
||||
}
|
||||
}
|
||||
|
@ -40,14 +40,13 @@ static INLINE void vp10_write_tree_r(struct AnsCoder *const ans,
|
||||
struct { uint8_t bit; vpx_prob prob; } scratch[VP10_TOKEN_SCRATCH_LEN];
|
||||
// assert(len < VP10_TOKEN_SCRATCH_LEN);
|
||||
|
||||
for (i = 0; i < len; ++i) {
|
||||
const int bit = bits & 1;
|
||||
bits >>= 1;
|
||||
for (i = len - 1; i >= 0; --i) {
|
||||
const int bit = (bits >> i) & 1;
|
||||
scratch[i].bit = bit;
|
||||
scratch[i].prob = probs[tidx >> 1];
|
||||
tidx = tree[tidx + bit];
|
||||
}
|
||||
for (i = len; i >= 0; --i) {
|
||||
for (i = 0; i < len; ++i) {
|
||||
rabs_write(ans, scratch[i].bit, scratch[i].prob);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user