summaryrefslogtreecommitdiffstats
path: root/encoder
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2015-06-09 16:38:50 +0300
committerMarco Nelissen <marcone@google.com>2015-06-25 08:25:49 -0700
commitcb6a43532c0b863d46c82feb25b10dc8732a34f9 (patch)
tree289301def7fc4ef9b82767721edca626e92bd8ff /encoder
parent9113f5615cb4b2be179b288a59324de723d2ec9a (diff)
downloadandroid_external_libavc-cb6a43532c0b863d46c82feb25b10dc8732a34f9.tar.gz
android_external_libavc-cb6a43532c0b863d46c82feb25b10dc8732a34f9.tar.bz2
android_external_libavc-cb6a43532c0b863d46c82feb25b10dc8732a34f9.zip
Set the luma/chroma strides depending on source buffer
If the data is read directly from the input buffer, set the stride values to those of the input buffer. If the data is copied, set the stride to the value of the local buffer instead. This fixes handling of cases where the input buffer stride is (significantly) larger than the maxwidth of the video. This also effectively makes the parameter ive_ctl_set_dimensions_ip_t.u4_strd useless - nothing needs to know the stride until you actually encode a frame, and at that point, we can either use the stride of the input buffer, or of the local pu1_y_csc_buf_base where the copied content is stored. Change-Id: Icde400b4a0867d25855e621e143454e608748aa3
Diffstat (limited to 'encoder')
-rw-r--r--encoder/ih264e_me.c2
-rw-r--r--encoder/ih264e_process.c12
2 files changed, 12 insertions, 2 deletions
diff --git a/encoder/ih264e_me.c b/encoder/ih264e_me.c
index 6fef9d9..68bdea6 100644
--- a/encoder/ih264e_me.c
+++ b/encoder/ih264e_me.c
@@ -841,6 +841,8 @@ void ih264e_init_me(process_ctxt_t *ps_proc)
/* src ptr */
ps_me_ctxt->pu1_src_buf_luma = ps_proc->pu1_src_buf_luma;
+ /* src stride */
+ ps_me_ctxt->i4_src_strd = ps_proc->i4_src_strd;
/* ref ptrs and corresponding lagrange params */
ps_me_ctxt->apu1_ref_buf_luma[0] = ps_proc->apu1_ref_buf_luma[0];
diff --git a/encoder/ih264e_process.c b/encoder/ih264e_process.c
index ff48f7e..2c3a18e 100644
--- a/encoder/ih264e_process.c
+++ b/encoder/ih264e_process.c
@@ -1187,15 +1187,21 @@ IH264E_ERROR_T ih264e_init_proc_ctxt(process_ctxt_t *ps_proc)
/* init buffer pointers */
convert_uv_only = 1;
- if (u4_pad_bottom_sz && (ps_proc->i4_mb_y == ps_proc->i4_ht_mbs - 1))
+ if ((u4_pad_bottom_sz && (ps_proc->i4_mb_y == ps_proc->i4_ht_mbs - 1)) ||
+ ps_codec->s_cfg.e_inp_color_fmt == IV_YUV_422ILE)
{
- u2_num_rows = (UWORD16) MB_SIZE - u4_pad_bottom_sz;
+ if (ps_proc->i4_mb_y == ps_proc->i4_ht_mbs - 1)
+ u2_num_rows = (UWORD16) MB_SIZE - u4_pad_bottom_sz;
ps_proc->pu1_src_buf_luma_base = ps_codec->pu1_y_csc_buf_base;
+ i4_src_strd = ps_proc->i4_src_strd = ps_codec->s_cfg.u4_max_wd;
ps_proc->pu1_src_buf_luma = ps_proc->pu1_src_buf_luma_base + (i4_mb_x * MB_SIZE) + ps_codec->s_cfg.u4_max_wd * (i4_mb_y * MB_SIZE);
convert_uv_only = 0;
}
else
+ {
+ i4_src_strd = ps_proc->i4_src_strd = ps_proc->s_inp_buf.s_raw_buf.au4_strd[0];
ps_proc->pu1_src_buf_luma = ps_proc->pu1_src_buf_luma_base + (i4_mb_x * MB_SIZE) + i4_src_strd * (i4_mb_y * MB_SIZE);
+ }
if (ps_codec->s_cfg.e_inp_color_fmt == IV_YUV_422ILE ||
@@ -1207,9 +1213,11 @@ IH264E_ERROR_T ih264e_init_proc_ctxt(process_ctxt_t *ps_proc)
ps_proc->pu1_src_buf_chroma_base = ps_codec->pu1_uv_csc_buf_base;
ps_proc->pu1_src_buf_chroma = ps_proc->pu1_src_buf_chroma_base + (i4_mb_x * MB_SIZE) + ps_codec->s_cfg.u4_max_wd * (i4_mb_y * BLK8x8SIZE);
+ i4_src_chroma_strd = ps_proc->i4_src_chroma_strd = ps_codec->s_cfg.u4_max_wd;
}
else
{
+ i4_src_chroma_strd = ps_proc->i4_src_chroma_strd = ps_proc->s_inp_buf.s_raw_buf.au4_strd[1];
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);
}