Skip to content

Commit

Permalink
y4m_input: do not resample chroma for 420mpeg2 input
Browse files Browse the repository at this point in the history
This is patched to align with AOM handling of 420mpeg2:
https://aomedia.googlesource.com/aom/+/2656f676d3fcdef83d1155cd91b1bfb7f657b486
  • Loading branch information
kylophone committed Sep 21, 2021
1 parent db7e336 commit 80ba609
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions libvmaf/tools/y4m_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,8 @@ static int y4m_input_open_impl(y4m_input *_y4m,FILE *_fin){
}
_y4m->depth=8;
if(strcmp(_y4m->chroma_type,"420")==0||
strcmp(_y4m->chroma_type,"420jpeg")==0){
strcmp(_y4m->chroma_type,"420jpeg")==0||
strcmp(_y4m->chroma_type,"420mpeg2")==0){
_y4m->src_c_dec_h=_y4m->dst_c_dec_h=_y4m->src_c_dec_v=_y4m->dst_c_dec_v=2;
_y4m->dst_buf_read_sz=_y4m->pic_w*_y4m->pic_h
+2*((_y4m->pic_w+1)/2)*((_y4m->pic_h+1)/2);
Expand All @@ -618,14 +619,6 @@ static int y4m_input_open_impl(y4m_input *_y4m,FILE *_fin){
_y4m->aux_buf_sz=_y4m->aux_buf_read_sz=0;
_y4m->convert=y4m_convert_null;
}
else if(strcmp(_y4m->chroma_type,"420mpeg2")==0){
_y4m->src_c_dec_h=_y4m->dst_c_dec_h=_y4m->src_c_dec_v=_y4m->dst_c_dec_v=2;
_y4m->dst_buf_read_sz=_y4m->pic_w*_y4m->pic_h;
/*Chroma filter required: read into the aux buf first.*/
_y4m->aux_buf_sz=_y4m->aux_buf_read_sz=
2*((_y4m->pic_w+1)/2)*((_y4m->pic_h+1)/2);
_y4m->convert=y4m_convert_42xmpeg2_42xjpeg;
}
else if(strcmp(_y4m->chroma_type,"420paldv")==0){
_y4m->src_c_dec_h=_y4m->dst_c_dec_h=_y4m->src_c_dec_v=_y4m->dst_c_dec_v=2;
_y4m->dst_buf_read_sz=_y4m->pic_w*_y4m->pic_h;
Expand Down

0 comments on commit 80ba609

Please sign in to comment.