Lines Matching refs:fhdr
648 bool Vp9UncompressedHeaderParser::ReadColorConfig(Vp9FrameHeader* fhdr) { in ReadColorConfig() argument
649 if (fhdr->profile == 2 || fhdr->profile == 3) { in ReadColorConfig()
650 fhdr->bit_depth = reader_.ReadBool() ? 12 : 10; in ReadColorConfig()
652 fhdr->bit_depth = 8; in ReadColorConfig()
655 fhdr->color_space = static_cast<Vp9ColorSpace>(reader_.ReadLiteral(3)); in ReadColorConfig()
656 if (fhdr->color_space != Vp9ColorSpace::SRGB) { in ReadColorConfig()
657 fhdr->color_range = reader_.ReadBool(); in ReadColorConfig()
658 if (fhdr->profile == 1 || fhdr->profile == 3) { in ReadColorConfig()
659 fhdr->subsampling_x = reader_.ReadBool() ? 1 : 0; in ReadColorConfig()
660 fhdr->subsampling_y = reader_.ReadBool() ? 1 : 0; in ReadColorConfig()
661 if (fhdr->subsampling_x == 1 && fhdr->subsampling_y == 1) { in ReadColorConfig()
671 fhdr->subsampling_x = fhdr->subsampling_y = 1; in ReadColorConfig()
674 fhdr->color_range = true; in ReadColorConfig()
675 if (fhdr->profile == 1 || fhdr->profile == 3) { in ReadColorConfig()
676 fhdr->subsampling_x = fhdr->subsampling_y = 0; in ReadColorConfig()
693 void Vp9UncompressedHeaderParser::ReadFrameSize(Vp9FrameHeader* fhdr) { in ReadFrameSize() argument
694 fhdr->frame_width = reader_.ReadLiteral(16) + 1; in ReadFrameSize()
695 fhdr->frame_height = reader_.ReadLiteral(16) + 1; in ReadFrameSize()
699 void Vp9UncompressedHeaderParser::ReadRenderSize(Vp9FrameHeader* fhdr) { in ReadRenderSize() argument
701 fhdr->render_width = reader_.ReadLiteral(16) + 1; in ReadRenderSize()
702 fhdr->render_height = reader_.ReadLiteral(16) + 1; in ReadRenderSize()
704 fhdr->render_width = fhdr->frame_width; in ReadRenderSize()
705 fhdr->render_height = fhdr->frame_height; in ReadRenderSize()
710 bool Vp9UncompressedHeaderParser::ReadFrameSizeFromRefs(Vp9FrameHeader* fhdr) { in ReadFrameSizeFromRefs() argument
712 for (const auto& idx : fhdr->ref_frame_idx) { in ReadFrameSizeFromRefs()
717 fhdr->frame_width = ref.frame_width; in ReadFrameSizeFromRefs()
718 fhdr->frame_height = ref.frame_height; in ReadFrameSizeFromRefs()
721 DCHECK_LE(fhdr->frame_width, kMaxDimension); in ReadFrameSizeFromRefs()
722 DCHECK_LE(fhdr->frame_height, kMaxDimension); in ReadFrameSizeFromRefs()
728 ReadFrameSize(fhdr); in ReadFrameSizeFromRefs()
732 for (const auto& idx : fhdr->ref_frame_idx) { in ReadFrameSizeFromRefs()
734 if (2 * fhdr->frame_width >= ref.frame_width && in ReadFrameSizeFromRefs()
735 2 * fhdr->frame_height >= ref.frame_height && in ReadFrameSizeFromRefs()
736 fhdr->frame_width <= 16 * ref.frame_width && in ReadFrameSizeFromRefs()
737 fhdr->frame_height <= 16 * ref.frame_height) { in ReadFrameSizeFromRefs()
748 ReadRenderSize(fhdr); in ReadFrameSizeFromRefs()
765 void Vp9UncompressedHeaderParser::SetupPastIndependence(Vp9FrameHeader* fhdr) { in SetupPastIndependence() argument
768 fhdr->frame_context = kVp9DefaultFrameContext; in SetupPastIndependence()
769 DCHECK(fhdr->frame_context.IsValid()); in SetupPastIndependence()
875 bool Vp9UncompressedHeaderParser::ReadTileInfo(Vp9FrameHeader* fhdr) { in ReadTileInfo() argument
876 int sb64_cols = (fhdr->frame_width + 63) / 64; in ReadTileInfo()
882 fhdr->tile_cols_log2 = min_log2_tile_cols; in ReadTileInfo()
884 fhdr->tile_cols_log2++; in ReadTileInfo()
886 fhdr->tile_rows_log2 = reader_.ReadBool() ? 1 : 0; in ReadTileInfo()
887 if (fhdr->tile_rows_log2 > 0 && reader_.ReadBool()) in ReadTileInfo()
888 fhdr->tile_rows_log2++; in ReadTileInfo()
891 if (fhdr->tile_cols_log2 > 6) { in ReadTileInfo()
916 Vp9FrameHeader* fhdr) { in Parse() argument
920 fhdr->data = stream; in Parse()
921 fhdr->frame_size = frame_size; in Parse()
929 fhdr->profile = ReadProfile(); in Parse()
930 if (fhdr->profile >= kVp9MaxProfile) { in Parse()
935 fhdr->show_existing_frame = reader_.ReadBool(); in Parse()
936 if (fhdr->show_existing_frame) { in Parse()
937 fhdr->frame_to_show_map_idx = reader_.ReadLiteral(3); in Parse()
938 fhdr->show_frame = true; in Parse()
948 fhdr->uncompressed_header_size = reader_.GetBytesRead(); in Parse()
949 fhdr->header_size_in_bytes = 0; in Parse()
953 fhdr->frame_type = static_cast<Vp9FrameHeader::FrameType>(reader_.ReadBool()); in Parse()
954 fhdr->show_frame = reader_.ReadBool(); in Parse()
955 fhdr->error_resilient_mode = reader_.ReadBool(); in Parse()
957 if (fhdr->IsKeyframe()) { in Parse()
961 if (!ReadColorConfig(fhdr)) in Parse()
964 ReadFrameSize(fhdr); in Parse()
965 ReadRenderSize(fhdr); in Parse()
966 fhdr->refresh_frame_flags = 0xff; in Parse()
968 if (!fhdr->show_frame) in Parse()
969 fhdr->intra_only = reader_.ReadBool(); in Parse()
971 if (!fhdr->error_resilient_mode) in Parse()
972 fhdr->reset_frame_context = reader_.ReadLiteral(2); in Parse()
974 if (fhdr->intra_only) { in Parse()
978 if (fhdr->profile > 0) { in Parse()
979 if (!ReadColorConfig(fhdr)) in Parse()
982 fhdr->bit_depth = 8; in Parse()
983 fhdr->color_space = Vp9ColorSpace::BT_601; in Parse()
984 fhdr->subsampling_x = fhdr->subsampling_y = 1; in Parse()
987 fhdr->refresh_frame_flags = reader_.ReadLiteral(8); in Parse()
989 ReadFrameSize(fhdr); in Parse()
990 ReadRenderSize(fhdr); in Parse()
992 fhdr->refresh_frame_flags = reader_.ReadLiteral(8); in Parse()
994 static_assert(arraysize(fhdr->ref_frame_sign_bias) >= in Parse()
998 fhdr->ref_frame_idx[i] = reader_.ReadLiteral(kVp9NumRefFramesLog2); in Parse()
999 fhdr->ref_frame_sign_bias[Vp9RefType::VP9_FRAME_LAST + i] = in Parse()
1005 context_->GetRefSlot(fhdr->ref_frame_idx[i]); in Parse()
1008 << "]=" << static_cast<int>(fhdr->ref_frame_idx[i]) in Parse()
1016 if (ref.profile != fhdr->profile) { in Parse()
1023 fhdr->bit_depth = ref.bit_depth; in Parse()
1024 fhdr->color_space = ref.color_space; in Parse()
1025 fhdr->subsampling_x = ref.subsampling_x; in Parse()
1026 fhdr->subsampling_y = ref.subsampling_y; in Parse()
1028 if (fhdr->bit_depth != ref.bit_depth) { in Parse()
1032 if (fhdr->color_space != ref.color_space) { in Parse()
1036 if (fhdr->subsampling_x != ref.subsampling_x || in Parse()
1037 fhdr->subsampling_y != ref.subsampling_y) { in Parse()
1044 if (!ReadFrameSizeFromRefs(fhdr)) in Parse()
1047 fhdr->allow_high_precision_mv = reader_.ReadBool(); in Parse()
1048 fhdr->interpolation_filter = ReadInterpolationFilter(); in Parse()
1052 if (fhdr->error_resilient_mode) { in Parse()
1053 fhdr->refresh_frame_context = false; in Parse()
1054 fhdr->frame_parallel_decoding_mode = true; in Parse()
1056 fhdr->refresh_frame_context = reader_.ReadBool(); in Parse()
1057 fhdr->frame_parallel_decoding_mode = reader_.ReadBool(); in Parse()
1060 fhdr->frame_context_idx_to_save_probs = fhdr->frame_context_idx = in Parse()
1063 if (fhdr->IsIntra()) { in Parse()
1064 SetupPastIndependence(fhdr); in Parse()
1065 if (fhdr->IsKeyframe() || fhdr->error_resilient_mode || in Parse()
1066 fhdr->reset_frame_context == 3) { in Parse()
1068 context_->UpdateFrameContext(i, fhdr->frame_context); in Parse()
1069 } else if (fhdr->reset_frame_context == 2) { in Parse()
1070 context_->UpdateFrameContext(fhdr->frame_context_idx, in Parse()
1071 fhdr->frame_context); in Parse()
1073 fhdr->frame_context_idx = 0; in Parse()
1077 ReadQuantizationParams(&fhdr->quant_params); in Parse()
1081 if (!ReadTileInfo(fhdr)) in Parse()
1084 fhdr->header_size_in_bytes = reader_.ReadLiteral(16); in Parse()
1085 if (fhdr->header_size_in_bytes == 0) { in Parse()
1098 fhdr->uncompressed_header_size = reader_.GetBytesRead(); in Parse()