avcenc: Fix PSNR computation for 420 semi-planar output in test
PSNR computation for 420 Semi-planar recon was incorrect.
Bug: 173151765
Test: avcenc -i qcif.yuv -w 176 -h 144 --bitrate 512000 \
-o out.h264 --recon_enable 1 --recon recon.yuv \
--input_chroma_format YUV_420SP_VU --recon_chroma_format \
YUV_420SP_VU --num_frames 4 --psnr 1
Change-Id: I8de628107894bfdef6027f865b235aa01349bc4d
This commit is contained in:
parent
443b102698
commit
29393d25cd
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