diff options
author | trav90 <travawine@palemoon.org> | 2018-10-18 21:53:44 -0500 |
---|---|---|
committer | trav90 <travawine@palemoon.org> | 2018-10-18 21:53:44 -0500 |
commit | ec910d81405c736a4490383a250299a7837c2e64 (patch) | |
tree | 4f27cc226f93a863121aef6c56313e4153a69b3e /third_party/aom/av1/encoder/global_motion.c | |
parent | 01eb57073ba97b2d6cbf20f745dfcc508197adc3 (diff) | |
download | UXP-ec910d81405c736a4490383a250299a7837c2e64.tar UXP-ec910d81405c736a4490383a250299a7837c2e64.tar.gz UXP-ec910d81405c736a4490383a250299a7837c2e64.tar.lz UXP-ec910d81405c736a4490383a250299a7837c2e64.tar.xz UXP-ec910d81405c736a4490383a250299a7837c2e64.zip |
Update aom to commit id e87fb2378f01103d5d6e477a4ef6892dc714e614
Diffstat (limited to 'third_party/aom/av1/encoder/global_motion.c')
-rw-r--r-- | third_party/aom/av1/encoder/global_motion.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/third_party/aom/av1/encoder/global_motion.c b/third_party/aom/av1/encoder/global_motion.c index 661a1feb4..4d44e9a6f 100644 --- a/third_party/aom/av1/encoder/global_motion.c +++ b/third_party/aom/av1/encoder/global_motion.c @@ -244,14 +244,18 @@ static unsigned char *downconvert_frame(YV12_BUFFER_CONFIG *frm, int bit_depth) { int i, j; uint16_t *orig_buf = CONVERT_TO_SHORTPTR(frm->y_buffer); - uint8_t *buf = malloc(frm->y_height * frm->y_stride * sizeof(*buf)); - - for (i = 0; i < frm->y_height; ++i) - for (j = 0; j < frm->y_width; ++j) - buf[i * frm->y_stride + j] = - orig_buf[i * frm->y_stride + j] >> (bit_depth - 8); - - return buf; + uint8_t *buf_8bit = frm->y_buffer_8bit; + assert(buf_8bit); + if (!frm->buf_8bit_valid) { + for (i = 0; i < frm->y_height; ++i) { + for (j = 0; j < frm->y_width; ++j) { + buf_8bit[i * frm->y_stride + j] = + orig_buf[i * frm->y_stride + j] >> (bit_depth - 8); + } + } + frm->buf_8bit_valid = 1; + } + return buf_8bit; } #endif @@ -274,16 +278,10 @@ int compute_global_motion_feature_based( if (frm->flags & YV12_FLAG_HIGHBITDEPTH) { // The frame buffer is 16-bit, so we need to convert to 8 bits for the // following code. We cache the result until the frame is released. - if (frm->y_buffer_8bit) - frm_buffer = frm->y_buffer_8bit; - else - frm_buffer = frm->y_buffer_8bit = downconvert_frame(frm, bit_depth); + frm_buffer = downconvert_frame(frm, bit_depth); } if (ref->flags & YV12_FLAG_HIGHBITDEPTH) { - if (ref->y_buffer_8bit) - ref_buffer = ref->y_buffer_8bit; - else - ref_buffer = ref->y_buffer_8bit = downconvert_frame(ref, bit_depth); + ref_buffer = downconvert_frame(ref, bit_depth); } #endif |