summaryrefslogtreecommitdiffstats
path: root/encoder
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2015-06-09 16:25:51 +0300
committerMarco Nelissen <marcone@google.com>2015-06-25 08:25:49 -0700
commit9113f5615cb4b2be179b288a59324de723d2ec9a (patch)
tree0e321d28de80066fc7e634e7df30b8270cca858c /encoder
parentbc8456b296416f862624abb539d74a06a6b36e0e (diff)
downloadandroid_external_libavc-9113f5615cb4b2be179b288a59324de723d2ec9a.tar.gz
android_external_libavc-9113f5615cb4b2be179b288a59324de723d2ec9a.tar.bz2
android_external_libavc-9113f5615cb4b2be179b288a59324de723d2ec9a.zip
Use a separate field for the chroma stride
When both luma and chroma are copied to the local buffer (either due to yuv format conversion, or due to padding), they have got the same stride, but if chroma is copied while luma is used directly from the input buffer, they might have different strides. Therefore add a separate field for chroma stride. This commit only adds the field, while it still has got the same value as before. Change-Id: I0dce97ad4d91cd1d9aba4b4472c6a0de45a314bc
Diffstat (limited to 'encoder')
-rw-r--r--encoder/ih264e_core_coding.c4
-rw-r--r--encoder/ih264e_intra_modes_eval.c2
-rw-r--r--encoder/ih264e_process.c17
-rw-r--r--encoder/ih264e_structs.h8
-rw-r--r--encoder/ih264e_utils.c1
5 files changed, 19 insertions, 13 deletions
diff --git a/encoder/ih264e_core_coding.c b/encoder/ih264e_core_coding.c
index 05a891d..76266d7 100644
--- a/encoder/ih264e_core_coding.c
+++ b/encoder/ih264e_core_coding.c
@@ -2022,7 +2022,7 @@ UWORD8 ih264e_code_chroma_intra_macroblock_8x8(process_ctxt_t *ps_proc)
WORD16 *pi2_res_mb = ps_proc->pi2_res_buf;
/* strides */
- WORD32 i4_src_strd = ps_proc->i4_src_strd;
+ WORD32 i4_src_strd = ps_proc->i4_src_chroma_strd;
WORD32 i4_rec_strd = ps_proc->i4_rec_strd;
WORD32 i4_pred_strd = ps_proc->i4_pred_strd;
WORD32 i4_res_strd = ps_proc->i4_res_strd;
@@ -2284,7 +2284,7 @@ UWORD8 ih264e_code_chroma_inter_macroblock_8x8(process_ctxt_t *ps_proc)
WORD16 *pi2_res_mb = ps_proc->pi2_res_buf;
/* strides */
- WORD32 i4_src_strd = ps_proc->i4_src_strd;
+ WORD32 i4_src_strd = ps_proc->i4_src_chroma_strd;
WORD32 i4_rec_strd = ps_proc->i4_rec_strd;
WORD32 i4_pred_strd = ps_proc->i4_pred_strd;
WORD32 i4_res_strd = ps_proc->i4_res_strd;
diff --git a/encoder/ih264e_intra_modes_eval.c b/encoder/ih264e_intra_modes_eval.c
index 74adbbc..52b3034 100644
--- a/encoder/ih264e_intra_modes_eval.c
+++ b/encoder/ih264e_intra_modes_eval.c
@@ -1318,7 +1318,7 @@ void ih264e_evaluate_chroma_intra8x8_modes_for_least_cost_rdoptoff(process_ctxt_
UWORD8 *pu1_pred_mb_plane = ps_proc->pu1_pred_mb_intra_chroma_plane;
/* strides */
- WORD32 i4_src_strd_c = ps_proc->i4_src_strd;
+ WORD32 i4_src_strd_c = ps_proc->i4_src_chroma_strd;
WORD32 i4_pred_strd = ps_proc->i4_pred_strd;
WORD32 i4_rec_strd_c = ps_proc->i4_rec_strd;
diff --git a/encoder/ih264e_process.c b/encoder/ih264e_process.c
index aa84af6..ff48f7e 100644
--- a/encoder/ih264e_process.c
+++ b/encoder/ih264e_process.c
@@ -1150,6 +1150,7 @@ IH264E_ERROR_T ih264e_init_proc_ctxt(process_ctxt_t *ps_proc)
/* strides */
WORD32 i4_src_strd = ps_proc->i4_src_strd;
+ WORD32 i4_src_chroma_strd = ps_proc->i4_src_chroma_strd;
WORD32 i4_rec_strd = ps_proc->i4_rec_strd;
/* quant params */
@@ -1209,7 +1210,7 @@ IH264E_ERROR_T ih264e_init_proc_ctxt(process_ctxt_t *ps_proc)
}
else
{
- ps_proc->pu1_src_buf_chroma = ps_proc->pu1_src_buf_chroma_base + (i4_mb_x * MB_SIZE) + i4_src_strd * (i4_mb_y * BLK8x8SIZE);
+ ps_proc->pu1_src_buf_chroma = ps_proc->pu1_src_buf_chroma_base + (i4_mb_x * MB_SIZE) + i4_src_chroma_strd * (i4_mb_y * BLK8x8SIZE);
}
ps_proc->pu1_rec_buf_luma = ps_proc->pu1_rec_buf_luma_base + (i4_mb_x * MB_SIZE) + i4_rec_strd * (i4_mb_y * MB_SIZE);
@@ -1261,7 +1262,7 @@ IH264E_ERROR_T ih264e_init_proc_ctxt(process_ctxt_t *ps_proc)
{
memcpy(pu1_dst, pu1_src, ps_codec->s_cfg.u4_wd);
pu1_src += ps_proc->s_inp_buf.s_raw_buf.au4_strd[1];
- pu1_dst += ps_proc->i4_src_strd;
+ pu1_dst += ps_proc->i4_src_chroma_strd;
}
}
@@ -1285,7 +1286,7 @@ IH264E_ERROR_T ih264e_init_proc_ctxt(process_ctxt_t *ps_proc)
ps_proc->s_inp_buf.s_raw_buf.au4_strd[0],
ps_proc->s_inp_buf.s_raw_buf.au4_strd[1],
ps_proc->s_inp_buf.s_raw_buf.au4_strd[2],
- ps_proc->i4_src_strd, ps_proc->i4_src_strd,
+ ps_proc->i4_src_strd, ps_proc->i4_src_chroma_strd,
convert_uv_only);
break;
@@ -1298,8 +1299,8 @@ IH264E_ERROR_T ih264e_init_proc_ctxt(process_ctxt_t *ps_proc)
ps_proc->pu1_src_buf_chroma,
ps_proc->pu1_src_buf_chroma + 1, pu1_y_buf_base,
ps_codec->s_cfg.u4_disp_wd, u2_num_rows,
- ps_proc->i4_src_strd, ps_proc->i4_src_strd,
- ps_proc->i4_src_strd,
+ ps_proc->i4_src_strd, ps_proc->i4_src_chroma_strd,
+ ps_proc->i4_src_chroma_strd,
ps_proc->s_inp_buf.s_raw_buf.au4_strd[0] >> 1);
break;
@@ -1323,7 +1324,7 @@ IH264E_ERROR_T ih264e_init_proc_ctxt(process_ctxt_t *ps_proc)
ih264_pad_right_chroma(
ps_proc->pu1_src_buf_chroma + ps_codec->s_cfg.u4_disp_wd,
- ps_proc->i4_src_strd, u4_pad_ht / 2, u4_pad_wd);
+ ps_proc->i4_src_chroma_strd, u4_pad_ht / 2, u4_pad_wd);
}
/* pad bottom edge */
@@ -1332,8 +1333,8 @@ IH264E_ERROR_T ih264e_init_proc_ctxt(process_ctxt_t *ps_proc)
ih264_pad_bottom(ps_proc->pu1_src_buf_luma + (MB_SIZE - u4_pad_bottom_sz) * ps_proc->i4_src_strd,
ps_proc->i4_src_strd, ps_proc->i4_src_strd, u4_pad_bottom_sz);
- ih264_pad_bottom(ps_proc->pu1_src_buf_chroma + (MB_SIZE - u4_pad_bottom_sz) * ps_proc->i4_src_strd / 2,
- ps_proc->i4_src_strd, ps_proc->i4_src_strd, (u4_pad_bottom_sz / 2));
+ ih264_pad_bottom(ps_proc->pu1_src_buf_chroma + (MB_SIZE - u4_pad_bottom_sz) * ps_proc->i4_src_chroma_strd / 2,
+ ps_proc->i4_src_chroma_strd, ps_proc->i4_src_chroma_strd, (u4_pad_bottom_sz / 2));
}
diff --git a/encoder/ih264e_structs.h b/encoder/ih264e_structs.h
index 80f2957..28d907c 100644
--- a/encoder/ih264e_structs.h
+++ b/encoder/ih264e_structs.h
@@ -1313,12 +1313,16 @@ struct _proc_t
mb_info_nmb_t *ps_cur_mb;
/**
- * source stride
- * (strides for luma and chroma are the same)
+ * source luma stride
*/
WORD32 i4_src_strd;
/**
+ * source chroma stride
+ */
+ WORD32 i4_src_chroma_strd;
+
+ /**
* recon stride & ref stride
* (strides for luma and chroma are the same)
*/
diff --git a/encoder/ih264e_utils.c b/encoder/ih264e_utils.c
index 74fd001..f48be5b 100644
--- a/encoder/ih264e_utils.c
+++ b/encoder/ih264e_utils.c
@@ -1731,6 +1731,7 @@ IH264E_ERROR_T ih264e_pic_init(codec_t *ps_codec, inp_buf_t *ps_inp_buf)
/* src stride */
ps_proc->i4_src_strd = ps_codec->i4_src_strd;
+ ps_proc->i4_src_chroma_strd = ps_codec->i4_src_strd;
/* rec stride */
ps_proc->i4_rec_strd = ps_codec->i4_rec_strd;