1 // Copyright 2016 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 // Note: ported from Chromium commit head: e5a9a62 5 6 #ifndef VP9_UNCOMPRESSED_HEADER_PARSER_H_ 7 #define VP9_UNCOMPRESSED_HEADER_PARSER_H_ 8 9 #include "vp9_parser.h" 10 #include "vp9_raw_bits_reader.h" 11 12 namespace media { 13 14 class Vp9UncompressedHeaderParser { 15 public: 16 Vp9UncompressedHeaderParser(Vp9Parser::Context* context); 17 18 // Parses VP9 uncompressed header in |stream| with |frame_size| into |fhdr|. 19 // Returns true if no error. 20 bool Parse(const uint8_t* stream, off_t frame_size, Vp9FrameHeader* fhdr); 21 22 private: 23 uint8_t ReadProfile(); 24 bool VerifySyncCode(); 25 bool ReadColorConfig(Vp9FrameHeader* fhdr); 26 void ReadFrameSize(Vp9FrameHeader* fhdr); 27 bool ReadFrameSizeFromRefs(Vp9FrameHeader* fhdr); 28 void ReadRenderSize(Vp9FrameHeader* fhdr); 29 Vp9InterpolationFilter ReadInterpolationFilter(); 30 void ResetLoopfilter(); 31 void SetupPastIndependence(Vp9FrameHeader* fhdr); 32 void ReadLoopFilterParams(); 33 void ReadQuantizationParams(Vp9QuantizationParams* quants); 34 int8_t ReadDeltaQ(); 35 uint8_t ReadProb(); 36 bool ReadSegmentationParams(); 37 bool ReadTileInfo(Vp9FrameHeader* fhdr); 38 39 // Raw bits reader for uncompressed frame header. 40 Vp9RawBitsReader reader_; 41 42 Vp9Parser::Context* context_; 43 44 DISALLOW_COPY_AND_ASSIGN(Vp9UncompressedHeaderParser); 45 }; 46 47 } // namespace media 48 49 #endif // VP9_UNCOMPRESSED_HEADER_PARSER_H_ 50