avcenc: Fix PSNR computation for 420 semi-planar output in test am: 29393d25cd
Original change: https://android-review.googlesource.com/c/platform/external/libavc/+/200630 Change-Id: I2a411057dd0145ea1c8ce9590986d903931d9c09
This commit is contained in:
commit
389e9708cc
1 changed files with 20 additions and 8 deletions
|
|
@ -111,13 +111,13 @@ void compute_psnr(app_ctxt_t *ps_app_ctxt, iv_raw_buf_t *ps_buf1, iv_raw_buf_t *
|
|||
pu1_buf2 = (UWORD8 *)ps_buf2->apv_bufs[comp];
|
||||
wd = ps_buf1->au4_wd[comp];
|
||||
ht = ps_buf1->au4_ht[comp];
|
||||
strd1 = ps_buf1->au4_strd[comp];
|
||||
strd2 = ps_buf2->au4_strd[comp];
|
||||
strd1 = ps_buf1->au4_strd[comp] - ps_buf1->au4_wd[comp];
|
||||
strd2 = ps_buf2->au4_strd[comp] - ps_buf2->au4_wd[comp];
|
||||
incr1 = 1;
|
||||
incr2 = 1;
|
||||
|
||||
if((IV_YUV_420SP_UV == ps_buf1->e_color_fmt)
|
||||
|| (IV_YUV_420SP_UV == ps_buf1->e_color_fmt))
|
||||
|| (IV_YUV_420SP_VU == ps_buf1->e_color_fmt))
|
||||
{
|
||||
switch(comp)
|
||||
{
|
||||
|
|
@ -130,6 +130,8 @@ void compute_psnr(app_ctxt_t *ps_app_ctxt, iv_raw_buf_t *ps_buf1, iv_raw_buf_t *
|
|||
else
|
||||
pu1_buf1 = (UWORD8 *)ps_buf1->apv_bufs[1] + 1;
|
||||
incr1 = 2;
|
||||
wd = ps_buf1->au4_wd[0] >> 1;
|
||||
ht = ps_buf1->au4_ht[0] >> 1;
|
||||
break;
|
||||
case 2:
|
||||
if(IV_YUV_420SP_UV == ps_buf1->e_color_fmt)
|
||||
|
|
@ -137,11 +139,14 @@ void compute_psnr(app_ctxt_t *ps_app_ctxt, iv_raw_buf_t *ps_buf1, iv_raw_buf_t *
|
|||
else
|
||||
pu1_buf1 = ps_buf1->apv_bufs[1];
|
||||
incr1 = 2;
|
||||
wd = ps_buf1->au4_wd[0] >> 1;
|
||||
ht = ps_buf1->au4_ht[0] >> 1;
|
||||
strd1 = ps_buf1->au4_strd[1] - ps_buf1->au4_wd[1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((IV_YUV_420SP_UV == ps_buf2->e_color_fmt)
|
||||
|| (IV_YUV_420SP_UV == ps_buf2->e_color_fmt))
|
||||
|| (IV_YUV_420SP_VU == ps_buf2->e_color_fmt))
|
||||
{
|
||||
switch(comp)
|
||||
{
|
||||
|
|
@ -153,14 +158,21 @@ void compute_psnr(app_ctxt_t *ps_app_ctxt, iv_raw_buf_t *ps_buf1, iv_raw_buf_t *
|
|||
pu1_buf2 = ps_buf2->apv_bufs[1];
|
||||
else
|
||||
pu1_buf2 = (UWORD8 *)ps_buf2->apv_bufs[1] + 1;
|
||||
incr1 = 2;
|
||||
incr2 = 2;
|
||||
wd = ps_buf2->au4_wd[0] >> 1;
|
||||
ht = ps_buf2->au4_ht[0] >> 1;
|
||||
|
||||
break;
|
||||
case 2:
|
||||
if(IV_YUV_420SP_UV == ps_buf2->e_color_fmt)
|
||||
pu1_buf2 = (UWORD8 *)ps_buf2->apv_bufs[1] + 1;
|
||||
else
|
||||
pu1_buf2 = ps_buf2->apv_bufs[1];
|
||||
incr1 = 2;
|
||||
incr2 = 2;
|
||||
wd = ps_buf2->au4_wd[0] >> 1;
|
||||
ht = ps_buf2->au4_ht[0] >> 1;
|
||||
strd2 = ps_buf2->au4_strd[1] - ps_buf2->au4_wd[1];
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -175,8 +187,8 @@ void compute_psnr(app_ctxt_t *ps_app_ctxt, iv_raw_buf_t *ps_buf1, iv_raw_buf_t *
|
|||
pu1_buf2 += incr2;
|
||||
df_psnr[comp] += diff * diff;
|
||||
}
|
||||
pu1_buf1 += strd1 - ps_buf1->au4_wd[comp];
|
||||
pu1_buf2 += strd2 - ps_buf2->au4_wd[comp];
|
||||
pu1_buf1 += strd1;
|
||||
pu1_buf2 += strd2;
|
||||
}
|
||||
df_psnr[comp] /= (wd * ht);
|
||||
if(df_psnr[comp])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue