mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-27 06:08:21 +01:00
Merge "slightly faster ParseIntraMode"
This commit is contained in:
commit
f486aaa9f8
@ -87,7 +87,6 @@ static const uint8_t kMVProba0[2][NUM_MV_PROBAS] = {
|
|||||||
// Paragraph 13.5
|
// Paragraph 13.5
|
||||||
static const uint8_t
|
static const uint8_t
|
||||||
CoeffsProba0[NUM_TYPES][NUM_BANDS][NUM_CTX][NUM_PROBAS] = {
|
CoeffsProba0[NUM_TYPES][NUM_BANDS][NUM_CTX][NUM_PROBAS] = {
|
||||||
// genereated using vp8_default_coef_probs() in entropy.c:129
|
|
||||||
{ { { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
|
{ { { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
|
||||||
{ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
|
{ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
|
||||||
{ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 }
|
{ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 }
|
||||||
@ -341,15 +340,15 @@ void VP8ParseIntraMode(VP8BitReader* const br, VP8Decoder* const dec) {
|
|||||||
uint8_t* const left = dec->intra_l_;
|
uint8_t* const left = dec->intra_l_;
|
||||||
VP8MBData* const block = dec->mb_data_;
|
VP8MBData* const block = dec->mb_data_;
|
||||||
|
|
||||||
// Hardcoded 16x16 intra-mode decision tree.
|
|
||||||
block->is_i4x4_ = !VP8GetBit(br, 145); // decide for B_PRED first
|
block->is_i4x4_ = !VP8GetBit(br, 145); // decide for B_PRED first
|
||||||
if (!block->is_i4x4_) {
|
if (!block->is_i4x4_) {
|
||||||
|
// Hardcoded 16x16 intra-mode decision tree.
|
||||||
const int ymode =
|
const int ymode =
|
||||||
VP8GetBit(br, 156) ? (VP8GetBit(br, 128) ? TM_PRED : H_PRED)
|
VP8GetBit(br, 156) ? (VP8GetBit(br, 128) ? TM_PRED : H_PRED)
|
||||||
: (VP8GetBit(br, 163) ? V_PRED : DC_PRED);
|
: (VP8GetBit(br, 163) ? V_PRED : DC_PRED);
|
||||||
block->imodes_[0] = ymode;
|
block->imodes_[0] = ymode;
|
||||||
memset(top, ymode, 4 * sizeof(top[0]));
|
memset(top, ymode, 4 * sizeof(*top));
|
||||||
memset(left, ymode, 4 * sizeof(left[0]));
|
memset(left, ymode, 4 * sizeof(*left));
|
||||||
} else {
|
} else {
|
||||||
uint8_t* modes = block->imodes_;
|
uint8_t* modes = block->imodes_;
|
||||||
int y;
|
int y;
|
||||||
@ -360,10 +359,10 @@ void VP8ParseIntraMode(VP8BitReader* const br, VP8Decoder* const dec) {
|
|||||||
const uint8_t* const prob = kBModesProba[top[x]][ymode];
|
const uint8_t* const prob = kBModesProba[top[x]][ymode];
|
||||||
#ifdef USE_GENERIC_TREE
|
#ifdef USE_GENERIC_TREE
|
||||||
// Generic tree-parsing
|
// Generic tree-parsing
|
||||||
int i = 0;
|
int i = kYModesIntra4[VP8GetBit(br, prob[0])];
|
||||||
do {
|
while (i > 0) {
|
||||||
i = kYModesIntra4[2 * i + VP8GetBit(br, prob[i])];
|
i = kYModesIntra4[2 * i + VP8GetBit(br, prob[i])];
|
||||||
} while (i > 0);
|
}
|
||||||
ymode = -i;
|
ymode = -i;
|
||||||
#else
|
#else
|
||||||
// Hardcoded tree parsing
|
// Hardcoded tree parsing
|
||||||
@ -378,8 +377,9 @@ void VP8ParseIntraMode(VP8BitReader* const br, VP8Decoder* const dec) {
|
|||||||
(!VP8GetBit(br, prob[8]) ? B_HD_PRED : B_HU_PRED)));
|
(!VP8GetBit(br, prob[8]) ? B_HD_PRED : B_HU_PRED)));
|
||||||
#endif // USE_GENERIC_TREE
|
#endif // USE_GENERIC_TREE
|
||||||
top[x] = ymode;
|
top[x] = ymode;
|
||||||
*modes++ = ymode;
|
|
||||||
}
|
}
|
||||||
|
memcpy(modes, top, 4 * sizeof(*top));
|
||||||
|
modes += 4;
|
||||||
left[y] = ymode;
|
left[y] = ymode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user