1 /*
2  * Copyright(c) 2019 Netflix, Inc.
3  * Copyright (c) 2016, Alliance for Open Media. All rights reserved
4  *
5  * This source code is subject to the terms of the BSD 2 Clause License and
6  * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
7  * was not distributed with this source code in the LICENSE file, you can
8  * obtain it at https://www.aomedia.org/license/software-license. If the Alliance for Open
9  * Media Patent License 1.0 was not distributed with this source code in the
10  * PATENTS file, you can obtain it at https://www.aomedia.org/license/patent-license.
11  */
12 
13 /******************************************************************************
14  * @file ParseUtil.cc
15  *
16  * @brief Impelmentation of sequence header parser.
17  *
18  ******************************************************************************/
19 
20 #include "EbDefinitions.h"
21 #include "EbDecParseObuUtil.h"
22 #include "ParseUtil.h"
23 #include "gtest/gtest.h"
24 
25 namespace svt_av1_e2e_tools {
26 
input_obu_data(const uint8_t * obu_data,const uint32_t size,RefDecoder::StreamInfo * stream_info)27 void SequenceHeaderParser::input_obu_data(const uint8_t* obu_data,
28                                           const uint32_t size,
29                                           RefDecoder::StreamInfo* stream_info) {
30     SeqHeader seg_header;
31     if (svt_get_sequence_info(obu_data, size, &seg_header) == EB_ErrorNone) {
32         profile_ = seg_header.seq_profile;
33         switch (seg_header.sb_size) {
34         case BLOCK_64X64: sb_size_ = 64; break;
35         case BLOCK_128X128: sb_size_ = 128; break;
36         default:
37             ASSERT_TRUE(false)
38                 << "super block size is invalid in sequence header!";
39             break;
40         }
41         printf("SPS header: profile(%u), sb_size(%u)\n", profile_, sb_size_);
42 
43         // update stream info
44         stream_info->profile = seg_header.seq_profile;
45         stream_info->still_pic = seg_header.still_picture == 1;
46         stream_info->sb_size = sb_size_;
47         stream_info->force_integer_mv = seg_header.seq_force_integer_mv;
48         stream_info->enable_filter_intra = seg_header.filter_intra_level;
49         stream_info->enable_intra_edge_filter =
50             seg_header.enable_intra_edge_filter;
51         stream_info->enable_masked_compound = seg_header.enable_masked_compound;
52         stream_info->enable_dual_filter = seg_header.enable_dual_filter;
53         stream_info->enable_jnt_comp =
54             seg_header.order_hint_info.enable_jnt_comp;
55         stream_info->enable_ref_frame_mvs =
56             seg_header.order_hint_info.enable_ref_frame_mvs;
57         stream_info->enable_warped_motion = seg_header.enable_warped_motion;
58         stream_info->cdef_level = seg_header.cdef_level;
59         stream_info->enable_restoration = seg_header.enable_restoration;
60         stream_info->enable_superres = seg_header.enable_superres;
61     }
62 }
63 }  // namespace svt_av1_e2e_tools
64