ref: 5127e58dab541a21f2953f8f0acb86da9170e042
parent: 61927ba4ac6390bc98396b9ba30d050f63e720fa
author: Ranjit Kumar Tulabandu <ranjit.tulabandu@ittiam.com>
date: Thu Feb 16 14:37:39 EST 2017
Structured the mode ordering code to avoid redundant memcpy Change-Id: I4f5d6b54018bd1928cd9e5e42619e6f55b334803
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -3169,15 +3169,14 @@
midx = sf->schedule_mode_search ? mode_skip_start : 0;
- memcpy(mode_map, tile_mode_map, sizeof(mode_map));
-
while (midx > 4) {
uint8_t end_pos = 0;
for (i = 5; i < midx; ++i) {
- if (mode_threshold[mode_map[i - 1]] > mode_threshold[mode_map[i]]) {
- uint8_t tmp = mode_map[i];
- mode_map[i] = mode_map[i - 1];
- mode_map[i - 1] = tmp;
+ if (mode_threshold[tile_mode_map[i - 1]] >
+ mode_threshold[tile_mode_map[i]]) {
+ uint8_t tmp = tile_mode_map[i];
+ tile_mode_map[i] = tile_mode_map[i - 1];
+ tile_mode_map[i - 1] = tmp;
end_pos = i;
}
}
@@ -3184,7 +3183,7 @@
midx = end_pos;
}
- memcpy(tile_mode_map, mode_map, sizeof(mode_map));
+ memcpy(mode_map, tile_mode_map, sizeof(mode_map));
#if CONFIG_MULTITHREAD
if (NULL != tile_data->enc_row_mt_mutex)