Skip to content

Commit 332dde6

Browse files
vibhoothikylophone
authored andcommitted
y4m_input: Expand to support yuv444p12/yuv422p12/yuv420p12
Tested locally with samples, Implementation based on https://aomedia.googlesource.com/aom/+/refs/heads/main/common/y4minput.c
1 parent 6b75f37 commit 332dde6

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

libvmaf/tools/y4m_input.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,15 @@ static int y4m_input_open_impl(y4m_input *_y4m,FILE *_fin){
611611
_y4m->aux_buf_sz=_y4m->aux_buf_read_sz=0;
612612
_y4m->convert=y4m_convert_null;
613613
}
614+
else if(strcmp(_y4m->chroma_type,"420p12")==0){
615+
_y4m->src_c_dec_h=_y4m->dst_c_dec_h=_y4m->src_c_dec_v=_y4m->dst_c_dec_v=2;
616+
_y4m->dst_buf_read_sz=(_y4m->pic_w*_y4m->pic_h
617+
+2*((_y4m->pic_w+1)/2)*((_y4m->pic_h+1)/2))*2;
618+
_y4m->depth=12;
619+
/*Natively supported: no conversion required.*/
620+
_y4m->aux_buf_sz=_y4m->aux_buf_read_sz=0;
621+
_y4m->convert=y4m_convert_null;
622+
}
614623
else if (strcmp(_y4m->chroma_type,"422p10")==0) {
615624
_y4m->src_c_dec_h=_y4m->dst_c_dec_h=2;
616625
_y4m->src_c_dec_v=_y4m->dst_c_dec_v=1;
@@ -620,6 +629,15 @@ static int y4m_input_open_impl(y4m_input *_y4m,FILE *_fin){
620629
_y4m->aux_buf_sz = _y4m->aux_buf_read_sz = 0;
621630
_y4m->convert = y4m_convert_null;
622631
}
632+
else if (strcmp(_y4m->chroma_type,"422p12")==0) {
633+
_y4m->src_c_dec_h=_y4m->dst_c_dec_h=2;
634+
_y4m->src_c_dec_v=_y4m->dst_c_dec_v=1;
635+
_y4m->depth = 12;
636+
_y4m->dst_buf_read_sz = 2*(_y4m->pic_w*_y4m->pic_h
637+
+2*((_y4m->pic_w+1)/2)*_y4m->pic_h);
638+
_y4m->aux_buf_sz = _y4m->aux_buf_read_sz = 0;
639+
_y4m->convert = y4m_convert_null;
640+
}
623641
else if(strcmp(_y4m->chroma_type,"444p10")==0){
624642
_y4m->src_c_dec_h=_y4m->dst_c_dec_h=_y4m->src_c_dec_v=_y4m->dst_c_dec_v=1;
625643
_y4m->dst_buf_read_sz=_y4m->pic_w*_y4m->pic_h*3*2;
@@ -628,6 +646,14 @@ static int y4m_input_open_impl(y4m_input *_y4m,FILE *_fin){
628646
_y4m->aux_buf_sz=_y4m->aux_buf_read_sz=0;
629647
_y4m->convert=y4m_convert_null;
630648
}
649+
else if(strcmp(_y4m->chroma_type,"444p12")==0){
650+
_y4m->src_c_dec_h=_y4m->dst_c_dec_h=_y4m->src_c_dec_v=_y4m->dst_c_dec_v=1;
651+
_y4m->dst_buf_read_sz=_y4m->pic_w*_y4m->pic_h*3*2;
652+
_y4m->depth=12;
653+
/*Natively supported: no conversion required.*/
654+
_y4m->aux_buf_sz=_y4m->aux_buf_read_sz=0;
655+
_y4m->convert=y4m_convert_null;
656+
}
631657
else if(strcmp(_y4m->chroma_type,"420paldv")==0){
632658
_y4m->src_c_dec_h=_y4m->dst_c_dec_h=_y4m->src_c_dec_v=_y4m->dst_c_dec_v=2;
633659
_y4m->dst_buf_read_sz=_y4m->pic_w*_y4m->pic_h;

0 commit comments

Comments
 (0)