diff --git a/src/enc/analysis.c b/src/enc/analysis.c index ce6338b7..4d7ce8ae 100644 --- a/src/enc/analysis.c +++ b/src/enc/analysis.c @@ -253,7 +253,7 @@ static int MBAnalyzeBestIntra16Mode(VP8EncIterator* const it) { static int MBAnalyzeBestIntra4Mode(VP8EncIterator* const it, int best_alpha) { - int modes[16]; + uint8_t modes[16]; const int max_mode = (it->enc_->method_ >= 3) ? MAX_INTRA4_MODE : NUM_BMODES; int i4_alpha = 0; VP8IteratorStartI4(it); diff --git a/src/enc/iterator.c b/src/enc/iterator.c index ea0222fc..16dbe0c1 100644 --- a/src/enc/iterator.c +++ b/src/enc/iterator.c @@ -294,15 +294,13 @@ void VP8SetIntra16Mode(const VP8EncIterator* const it, int mode) { it->mb_->type_ = 1; } -void VP8SetIntra4Mode(const VP8EncIterator* const it, int modes[16]) { +void VP8SetIntra4Mode(const VP8EncIterator* const it, const uint8_t* modes) { uint8_t* preds = it->preds_; int y; - for (y = 0; y < 4; ++y) { - int x; - for (x = 0; x < 4; ++x) { - preds[x] = modes[x + y * 4]; - } + for (y = 4; y > 0; --y) { + memcpy(preds, modes, 4 * sizeof(*modes)); preds += it->enc_->preds_w_; + modes += 4; } it->mb_->type_ = 0; } diff --git a/src/enc/quant.c b/src/enc/quant.c index 3dc1042b..ea153849 100644 --- a/src/enc/quant.c +++ b/src/enc/quant.c @@ -742,7 +742,7 @@ static void PickBestIntra16(VP8EncIterator* const it, VP8ModeScore* const rd) { // return the cost array corresponding to the surrounding prediction modes. static const uint16_t* GetCostModeI4(VP8EncIterator* const it, - const int modes[16]) { + const uint8_t modes[16]) { const int preds_w = it->enc_->preds_w_; const int x = (it->i4_ & 3), y = it->i4_ >> 2; const int left = (x == 0) ? it->preds_[y * preds_w - 1] : modes[it->i4_ - 1]; diff --git a/src/enc/vp8enci.h b/src/enc/vp8enci.h index 35295eee..326f7b19 100644 --- a/src/enc/vp8enci.h +++ b/src/enc/vp8enci.h @@ -243,7 +243,7 @@ typedef struct { int16_t y_ac_levels[16][16]; int16_t uv_levels[4 + 4][16]; int mode_i16; // mode number for intra16 prediction - int modes_i4[16]; // mode numbers for intra4 predictions + uint8_t modes_i4[16]; // mode numbers for intra4 predictions int mode_uv; // mode number of chroma prediction uint32_t nz; // non-zero blocks } VP8ModeScore; @@ -306,7 +306,7 @@ void VP8IteratorBytesToNz(VP8EncIterator* const it); // Helper functions to set mode properties void VP8SetIntra16Mode(const VP8EncIterator* const it, int mode); -void VP8SetIntra4Mode(const VP8EncIterator* const it, int modes[16]); +void VP8SetIntra4Mode(const VP8EncIterator* const it, const uint8_t* modes); void VP8SetIntraUVMode(const VP8EncIterator* const it, int mode); void VP8SetSkip(const VP8EncIterator* const it, int skip); void VP8SetSegment(const VP8EncIterator* const it, int segment);