Commit 54fb24aa authored by Hui Su's avatar Hui Su Committed by Gerrit Code Review
Browse files

Merge "Use sizeof(variable) instead of sizeof(type)"

parents 3acfe46e 088b05fd
......@@ -173,24 +173,24 @@ static void build_intra_predictors_high(const MACROBLOCKD *xd,
/* slower path if the block needs border extension */
if (x0 + 2 * bs <= frame_width) {
if (right_available && bs == 4) {
memcpy(above_row, above_ref, 2 * bs * sizeof(uint16_t));
memcpy(above_row, above_ref, 2 * bs * sizeof(above_row[0]));
} else {
memcpy(above_row, above_ref, bs * sizeof(uint16_t));
memcpy(above_row, above_ref, bs * sizeof(above_row[0]));
vpx_memset16(above_row + bs, above_row[bs - 1], bs);
}
} else if (x0 + bs <= frame_width) {
const int r = frame_width - x0;
if (right_available && bs == 4) {
memcpy(above_row, above_ref, r * sizeof(uint16_t));
memcpy(above_row, above_ref, r * sizeof(above_row[0]));
vpx_memset16(above_row + r, above_row[r - 1],
x0 + 2 * bs - frame_width);
} else {
memcpy(above_row, above_ref, bs * sizeof(uint16_t));
memcpy(above_row, above_ref, bs * sizeof(above_row[0]));
vpx_memset16(above_row + bs, above_row[bs - 1], bs);
}
} else if (x0 <= frame_width) {
const int r = frame_width - x0;
memcpy(above_row, above_ref, r * sizeof(uint16_t));
memcpy(above_row, above_ref, r * sizeof(above_row[0]));
vpx_memset16(above_row + r, above_row[r - 1],
x0 + 2 * bs - frame_width);
}
......@@ -201,9 +201,9 @@ static void build_intra_predictors_high(const MACROBLOCKD *xd,
if (bs == 4 && right_available && left_available) {
const_above_row = above_ref;
} else {
memcpy(above_row, above_ref, bs * sizeof(uint16_t));
memcpy(above_row, above_ref, bs * sizeof(above_row[0]));
if (bs == 4 && right_available)
memcpy(above_row + bs, above_ref + bs, bs * sizeof(uint16_t));
memcpy(above_row + bs, above_ref + bs, bs * sizeof(above_row[0]));
else
vpx_memset16(above_row + bs, above_row[bs - 1], bs);
// TODO(Peter): this value should probably change for high bitdepth
......
......@@ -1046,7 +1046,7 @@ static void update_state(VP9_COMP *cpi, ThreadData *td,
x->skip = ctx->skip;
memcpy(x->zcoeff_blk[mbmi->tx_size], ctx->zcoeff_blk,
sizeof(uint8_t) * ctx->num_4x4_blk);
sizeof(ctx->zcoeff_blk[0]) * ctx->num_4x4_blk);
if (!output_enabled)
return;
......
......@@ -74,7 +74,7 @@ static void highbd_copy_and_extend_plane(const uint8_t *src8, int src_pitch,
for (i = 0; i < h; i++) {
vpx_memset16(dst_ptr1, src_ptr1[0], extend_left);
memcpy(dst_ptr1 + extend_left, src_ptr1, w * sizeof(uint16_t));
memcpy(dst_ptr1 + extend_left, src_ptr1, w * sizeof(src_ptr1[0]));
vpx_memset16(dst_ptr2, src_ptr2[0], extend_right);
src_ptr1 += src_pitch;
src_ptr2 += src_pitch;
......@@ -91,12 +91,12 @@ static void highbd_copy_and_extend_plane(const uint8_t *src8, int src_pitch,
linesize = extend_left + extend_right + w;
for (i = 0; i < extend_top; i++) {
memcpy(dst_ptr1, src_ptr1, linesize * sizeof(uint16_t));
memcpy(dst_ptr1, src_ptr1, linesize * sizeof(src_ptr1[0]));
dst_ptr1 += dst_pitch;
}
for (i = 0; i < extend_bottom; i++) {
memcpy(dst_ptr2, src_ptr2, linesize * sizeof(uint16_t));
memcpy(dst_ptr2, src_ptr2, linesize * sizeof(src_ptr2[0]));
dst_ptr2 += dst_pitch;
}
}
......
......@@ -3396,7 +3396,7 @@ void vp10_rd_pick_inter_mode_sb(VP9_COMP *cpi,
if (!x->select_tx_size)
swap_block_ptr(x, ctx, 1, 0, 0, max_plane);
memcpy(ctx->zcoeff_blk, x->zcoeff_blk[mbmi->tx_size],
sizeof(uint8_t) * ctx->num_4x4_blk);
sizeof(ctx->zcoeff_blk[0]) * ctx->num_4x4_blk);
// TODO(debargha): enhance this test with a better distortion prediction
// based on qp, activity mask and history
......@@ -4137,7 +4137,7 @@ void vp10_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi,
if (!x->select_tx_size)
swap_block_ptr(x, ctx, 1, 0, 0, max_plane);
memcpy(ctx->zcoeff_blk, x->zcoeff_blk[TX_4X4],
sizeof(uint8_t) * ctx->num_4x4_blk);
sizeof(ctx->zcoeff_blk[0]) * ctx->num_4x4_blk);
for (i = 0; i < 4; i++)
best_bmodes[i] = xd->mi[0]->bmi[i];
......
......@@ -448,7 +448,7 @@ static void resize_multistep(const uint8_t *const input,
uint8_t *buf) {
int steps;
if (length == olength) {
memcpy(output, input, sizeof(uint8_t) * length);
memcpy(output, input, sizeof(output[0]) * length);
return;
}
steps = get_down2_steps(length, olength);
......@@ -741,7 +741,7 @@ static void highbd_resize_multistep(const uint16_t *const input,
int bd) {
int steps;
if (length == olength) {
memcpy(output, input, sizeof(uint16_t) * length);
memcpy(output, input, sizeof(output[0]) * length);
return;
}
steps = get_down2_steps(length, olength);
......
......@@ -186,24 +186,24 @@ static void build_intra_predictors_high(const MACROBLOCKD *xd,
/* slower path if the block needs border extension */
if (x0 + 2 * bs <= frame_width) {
if (right_available && bs == 4) {
memcpy(above_row, above_ref, 2 * bs * sizeof(uint16_t));
memcpy(above_row, above_ref, 2 * bs * sizeof(above_row[0]));
} else {
memcpy(above_row, above_ref, bs * sizeof(uint16_t));
memcpy(above_row, above_ref, bs * sizeof(above_row[0]));
vpx_memset16(above_row + bs, above_row[bs - 1], bs);
}
} else if (x0 + bs <= frame_width) {
const int r = frame_width - x0;
if (right_available && bs == 4) {
memcpy(above_row, above_ref, r * sizeof(uint16_t));
memcpy(above_row, above_ref, r * sizeof(above_row[0]));
vpx_memset16(above_row + r, above_row[r - 1],
x0 + 2 * bs - frame_width);
} else {
memcpy(above_row, above_ref, bs * sizeof(uint16_t));
memcpy(above_row, above_ref, bs * sizeof(above_row[0]));
vpx_memset16(above_row + bs, above_row[bs - 1], bs);
}
} else if (x0 <= frame_width) {
const int r = frame_width - x0;
memcpy(above_row, above_ref, r * sizeof(uint16_t));
memcpy(above_row, above_ref, r * sizeof(above_row[0]));
vpx_memset16(above_row + r, above_row[r - 1],
x0 + 2 * bs - frame_width);
}
......@@ -214,9 +214,9 @@ static void build_intra_predictors_high(const MACROBLOCKD *xd,
if (bs == 4 && right_available && left_available) {
const_above_row = above_ref;
} else {
memcpy(above_row, above_ref, bs * sizeof(uint16_t));
memcpy(above_row, above_ref, bs * sizeof(above_row[0]));
if (bs == 4 && right_available)
memcpy(above_row + bs, above_ref + bs, bs * sizeof(uint16_t));
memcpy(above_row + bs, above_ref + bs, bs * sizeof(above_row[0]));
else
vpx_memset16(above_row + bs, above_row[bs - 1], bs);
// TODO(Peter): this value should probably change for high bitdepth
......
......@@ -1046,7 +1046,7 @@ static void update_state(VP9_COMP *cpi, ThreadData *td,
x->skip = ctx->skip;
memcpy(x->zcoeff_blk[mbmi->tx_size], ctx->zcoeff_blk,
sizeof(uint8_t) * ctx->num_4x4_blk);
sizeof(ctx->zcoeff_blk[0]) * ctx->num_4x4_blk);
if (!output_enabled)
return;
......
......@@ -74,7 +74,7 @@ static void highbd_copy_and_extend_plane(const uint8_t *src8, int src_pitch,
for (i = 0; i < h; i++) {
vpx_memset16(dst_ptr1, src_ptr1[0], extend_left);
memcpy(dst_ptr1 + extend_left, src_ptr1, w * sizeof(uint16_t));
memcpy(dst_ptr1 + extend_left, src_ptr1, w * sizeof(src_ptr1[0]));
vpx_memset16(dst_ptr2, src_ptr2[0], extend_right);
src_ptr1 += src_pitch;
src_ptr2 += src_pitch;
......@@ -91,12 +91,12 @@ static void highbd_copy_and_extend_plane(const uint8_t *src8, int src_pitch,
linesize = extend_left + extend_right + w;
for (i = 0; i < extend_top; i++) {
memcpy(dst_ptr1, src_ptr1, linesize * sizeof(uint16_t));
memcpy(dst_ptr1, src_ptr1, linesize * sizeof(src_ptr1[0]));
dst_ptr1 += dst_pitch;
}
for (i = 0; i < extend_bottom; i++) {
memcpy(dst_ptr2, src_ptr2, linesize * sizeof(uint16_t));
memcpy(dst_ptr2, src_ptr2, linesize * sizeof(src_ptr2[0]));
dst_ptr2 += dst_pitch;
}
}
......
......@@ -3394,7 +3394,7 @@ void vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi,
if (!x->select_tx_size)
swap_block_ptr(x, ctx, 1, 0, 0, max_plane);
memcpy(ctx->zcoeff_blk, x->zcoeff_blk[mbmi->tx_size],
sizeof(uint8_t) * ctx->num_4x4_blk);
sizeof(ctx->zcoeff_blk[0]) * ctx->num_4x4_blk);
// TODO(debargha): enhance this test with a better distortion prediction
// based on qp, activity mask and history
......@@ -4135,7 +4135,7 @@ void vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi,
if (!x->select_tx_size)
swap_block_ptr(x, ctx, 1, 0, 0, max_plane);
memcpy(ctx->zcoeff_blk, x->zcoeff_blk[TX_4X4],
sizeof(uint8_t) * ctx->num_4x4_blk);
sizeof(ctx->zcoeff_blk[0]) * ctx->num_4x4_blk);
for (i = 0; i < 4; i++)
best_bmodes[i] = xd->mi[0]->bmi[i];
......
......@@ -448,7 +448,7 @@ static void resize_multistep(const uint8_t *const input,
uint8_t *buf) {
int steps;
if (length == olength) {
memcpy(output, input, sizeof(uint8_t) * length);
memcpy(output, input, sizeof(output[0]) * length);
return;
}
steps = get_down2_steps(length, olength);
......@@ -741,7 +741,7 @@ static void highbd_resize_multistep(const uint16_t *const input,
int bd) {
int steps;
if (length == olength) {
memcpy(output, input, sizeof(uint16_t) * length);
memcpy(output, input, sizeof(output[0]) * length);
return;
}
steps = get_down2_steps(length, olength);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment