summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vp9/encoder/vp9_encodeframe.c16
-rw-r--r--vp9/encoder/vp9_firstpass.c22
-rw-r--r--vp9/encoder/vp9_rdopt.c44
3 files changed, 34 insertions, 48 deletions
diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c
index 714a1bf5c..d1666df2a 100644
--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -356,8 +356,7 @@ static void update_state(VP9_COMP *cpi,
if ((xd->mb_to_right_edge >> (3 + LOG2_MI_SIZE)) + bw > x_idx &&
(xd->mb_to_bottom_edge >> (3 + LOG2_MI_SIZE)) + bh > y) {
MODE_INFO *mi_addr = xd->mode_info_context + x_idx + y * mis;
-
- vpx_memcpy(mi_addr, mi, sizeof(MODE_INFO));
+ *mi_addr = *mi;
}
}
}
@@ -367,15 +366,10 @@ static void update_state(VP9_COMP *cpi,
ctx->txfm_rd_diff[ALLOW_32X32] = ctx->txfm_rd_diff[ALLOW_16X16];
}
- if (mbmi->ref_frame != INTRA_FRAME &&
- mbmi->sb_type < BLOCK_SIZE_SB8X8) {
- vpx_memcpy(x->partition_info, &ctx->partition_info,
- sizeof(PARTITION_INFO));
-
- mbmi->mv[0].as_int =
- x->partition_info->bmi[3].mv.as_int;
- mbmi->mv[1].as_int =
- x->partition_info->bmi[3].second_mv.as_int;
+ if (mbmi->ref_frame != INTRA_FRAME && mbmi->sb_type < BLOCK_SIZE_SB8X8) {
+ *x->partition_info = ctx->partition_info;
+ mbmi->mv[0].as_int = x->partition_info->bmi[3].mv.as_int;
+ mbmi->mv[1].as_int = x->partition_info->bmi[3].second_mv.as_int;
}
x->skip = ctx->skip;
diff --git a/vp9/encoder/vp9_firstpass.c b/vp9/encoder/vp9_firstpass.c
index f57c8be6c..b07e37d7a 100644
--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -746,9 +746,7 @@ void vp9_first_pass(VP9_COMP *cpi) {
- cpi->source->ts_start);
// don't want to do output stats with a stack variable!
- memcpy(&cpi->twopass.this_frame_stats,
- &fps,
- sizeof(FIRSTPASS_STATS));
+ cpi->twopass.this_frame_stats = fps;
output_stats(cpi, cpi->output_pkt_list, &cpi->twopass.this_frame_stats);
accumulate_stats(&cpi->twopass.total_stats, &fps);
}
@@ -1673,7 +1671,7 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
break;
}
- vpx_memcpy(this_frame, &next_frame, sizeof(*this_frame));
+ *this_frame = next_frame;
old_boost_score = boost_score;
}
@@ -2107,14 +2105,14 @@ void vp9_second_pass(VP9_COMP *cpi) {
// keyframe and section processing !
if (cpi->twopass.frames_to_key == 0) {
// Define next KF group and assign bits to it
- vpx_memcpy(&this_frame_copy, &this_frame, sizeof(this_frame));
+ this_frame_copy = this_frame;
find_next_key_frame(cpi, &this_frame_copy);
}
// Is this a GF / ARF (Note that a KF is always also a GF)
if (cpi->frames_till_gf_update_due == 0) {
// Define next gf group and assign bits to it
- vpx_memcpy(&this_frame_copy, &this_frame, sizeof(this_frame));
+ this_frame_copy = this_frame;
#if CONFIG_MULTIPLE_ARF
if (cpi->multi_arf_enabled) {
@@ -2136,14 +2134,14 @@ void vp9_second_pass(VP9_COMP *cpi) {
// Assign a standard frames worth of bits from those allocated
// to the GF group
int bak = cpi->per_frame_bandwidth;
- vpx_memcpy(&this_frame_copy, &this_frame, sizeof(this_frame));
+ this_frame_copy = this_frame;
assign_std_frame_bits(cpi, &this_frame_copy);
cpi->per_frame_bandwidth = bak;
}
} else {
// Otherwise this is an ordinary frame
// Assign bits from those allocated to the GF group
- vpx_memcpy(&this_frame_copy, &this_frame, sizeof(this_frame));
+ this_frame_copy = this_frame;
assign_std_frame_bits(cpi, &this_frame_copy);
}
@@ -2201,7 +2199,7 @@ static int test_candidate_kf(VP9_COMP *cpi,
double decay_accumulator = 1.0;
double next_iiratio;
- vpx_memcpy(&local_next_frame, next_frame, sizeof(*next_frame));
+ local_next_frame = *next_frame;
// Note the starting file position so we can reset to it
start_pos = cpi->twopass.stats_in;
@@ -2294,7 +2292,7 @@ static void find_next_key_frame(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
cpi->twopass.frames_to_key = 1;
// Take a copy of the initial frame details
- vpx_memcpy(&first_frame, this_frame, sizeof(*this_frame));
+ first_frame = *this_frame;
cpi->twopass.kf_group_bits = 0; // Total bits available to kf group
cpi->twopass.kf_group_error_left = 0; // Group modified error score.
@@ -2313,7 +2311,7 @@ static void find_next_key_frame(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
kf_group_coded_err += this_frame->coded_error;
// load a the next frame's stats
- vpx_memcpy(&last_frame, this_frame, sizeof(*this_frame));
+ last_frame = *this_frame;
input_stats(cpi, this_frame);
// Provided that we are not at the end of the file...
@@ -2366,7 +2364,7 @@ static void find_next_key_frame(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
cpi->twopass.frames_to_key /= 2;
// Copy first frame details
- vpx_memcpy(&tmp_frame, &first_frame, sizeof(first_frame));
+ tmp_frame = first_frame;
// Reset to the start of the group
reset_fpf_position(cpi, start_position);
diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c
index 6a6473a56..58420da12 100644
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -1719,11 +1719,11 @@ static void store_coding_context(MACROBLOCK *x, PICK_MODE_CONTEXT *ctx,
// restored if we decide to encode this way
ctx->skip = x->skip;
ctx->best_mode_index = mode_index;
- vpx_memcpy(&ctx->mic, xd->mode_info_context,
- sizeof(MODE_INFO));
+ ctx->mic = *xd->mode_info_context;
+
if (partition)
- vpx_memcpy(&ctx->partition_info, partition,
- sizeof(PARTITION_INFO));
+ ctx->partition_info = *partition;
+
ctx->best_ref_mv.as_int = ref_mv->as_int;
ctx->second_best_ref_mv.as_int = second_ref_mv->as_int;
@@ -2443,7 +2443,7 @@ void vp9_rd_pick_intra_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
xd->mode_info_context->mbmi.mode = mode;
}
- vpx_memcpy(&ctx->mic, xd->mode_info_context, sizeof(MODE_INFO));
+ ctx->mic = *xd->mode_info_context;
}
int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
@@ -2811,12 +2811,10 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
tmp_best_ratey = rate_y;
tmp_best_distortion = distortion;
tmp_best_skippable = skippable;
- vpx_memcpy(&tmp_best_mbmode, mbmi, sizeof(MB_MODE_INFO));
- vpx_memcpy(&tmp_best_partition, x->partition_info,
- sizeof(PARTITION_INFO));
- for (i = 0; i < 4; i++) {
+ tmp_best_mbmode = *mbmi;
+ tmp_best_partition = *x->partition_info;
+ for (i = 0; i < 4; i++)
tmp_best_bmodes[i] = xd->mode_info_context->bmi[i];
- }
pred_exists = 1;
}
} // switchable_filter_index loop
@@ -2844,12 +2842,10 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
rate_y = tmp_best_ratey;
distortion = tmp_best_distortion;
skippable = tmp_best_skippable;
- vpx_memcpy(mbmi, &tmp_best_mbmode, sizeof(MB_MODE_INFO));
- vpx_memcpy(x->partition_info, &tmp_best_partition,
- sizeof(PARTITION_INFO));
- for (i = 0; i < 4; i++) {
+ *mbmi = tmp_best_mbmode;
+ *x->partition_info = tmp_best_partition;
+ for (i = 0; i < 4; i++)
xd->mode_info_context->bmi[i] = tmp_best_bmodes[i];
- }
}
rate2 += rate;
@@ -3003,14 +2999,12 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
*returnrate = rate2;
*returndistortion = distortion2;
best_rd = this_rd;
- vpx_memcpy(&best_mbmode, mbmi, sizeof(MB_MODE_INFO));
- vpx_memcpy(&best_partition, x->partition_info, sizeof(PARTITION_INFO));
+ best_mbmode = *mbmi;
+ best_partition = *x->partition_info;
- if (this_mode == I4X4_PRED || this_mode == SPLITMV) {
- for (i = 0; i < 4; i++) {
+ if (this_mode == I4X4_PRED || this_mode == SPLITMV)
+ for (i = 0; i < 4; i++)
best_bmodes[i] = xd->mode_info_context->bmi[i];
- }
- }
}
#if 0
// Testing this mode gave rise to an improvement in best error score.
@@ -3167,12 +3161,11 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
}
// macroblock modes
- vpx_memcpy(mbmi, &best_mbmode, sizeof(MB_MODE_INFO));
+ *mbmi = best_mbmode;
if (best_mbmode.ref_frame == INTRA_FRAME &&
best_mbmode.sb_type < BLOCK_SIZE_SB8X8) {
- for (i = 0; i < 4; i++) {
+ for (i = 0; i < 4; i++)
xd->mode_info_context->bmi[i].as_mode = best_bmodes[i].as_mode;
- }
}
if (best_mbmode.ref_frame != INTRA_FRAME &&
@@ -3180,12 +3173,13 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
for (i = 0; i < 4; i++)
xd->mode_info_context->bmi[i].as_mv[0].as_int =
best_bmodes[i].as_mv[0].as_int;
+
if (mbmi->second_ref_frame > 0)
for (i = 0; i < 4; i++)
xd->mode_info_context->bmi[i].as_mv[1].as_int =
best_bmodes[i].as_mv[1].as_int;
- vpx_memcpy(x->partition_info, &best_partition, sizeof(PARTITION_INFO));
+ *x->partition_info = best_partition;
mbmi->mv[0].as_int = x->partition_info->bmi[3].mv.as_int;
mbmi->mv[1].as_int = x->partition_info->bmi[3].second_mv.as_int;