Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Side by Side Diff: media/filters/vp9_uncompressed_header_parser.cc

Issue 2229353002: V4L2SVDA: Add a VP9Accelerator implementation utilizing the V4L2 VP9 frame API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/filters/vp9_uncompressed_header_parser.h" 5 #include "media/filters/vp9_uncompressed_header_parser.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 namespace media { 9 namespace media {
10 10
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 Vp9InterpolationFilter::EIGHTTAP_SMOOTH, Vp9InterpolationFilter::EIGHTTAP, 737 Vp9InterpolationFilter::EIGHTTAP_SMOOTH, Vp9InterpolationFilter::EIGHTTAP,
738 Vp9InterpolationFilter::EIGHTTAP_SHARP, Vp9InterpolationFilter::BILINEAR, 738 Vp9InterpolationFilter::EIGHTTAP_SHARP, Vp9InterpolationFilter::BILINEAR,
739 }; 739 };
740 return table[reader_.ReadLiteral(2)]; 740 return table[reader_.ReadLiteral(2)];
741 } 741 }
742 742
743 void Vp9UncompressedHeaderParser::SetupPastIndependence(Vp9FrameHeader* fhdr) { 743 void Vp9UncompressedHeaderParser::SetupPastIndependence(Vp9FrameHeader* fhdr) {
744 memset(&context_->segmentation, 0, sizeof(context_->segmentation)); 744 memset(&context_->segmentation, 0, sizeof(context_->segmentation));
745 ResetLoopfilter(); 745 ResetLoopfilter();
746 fhdr->frame_context = kVp9DefaultFrameContext; 746 fhdr->frame_context = kVp9DefaultFrameContext;
747 DCHECK(Vp9FrameContextManager::IsValidFrameContext(fhdr->frame_context)); 747 DCHECK(Vp9FrameContext::IsValid(fhdr->frame_context));
748 } 748 }
749 749
750 // 6.2.8 Loop filter params syntax 750 // 6.2.8 Loop filter params syntax
751 void Vp9UncompressedHeaderParser::ReadLoopFilterParams() { 751 void Vp9UncompressedHeaderParser::ReadLoopFilterParams() {
752 Vp9LoopFilterParams& loop_filter = context_->loop_filter; 752 Vp9LoopFilterParams& loop_filter = context_->loop_filter;
753 753
754 loop_filter.level = reader_.ReadLiteral(6); 754 loop_filter.level = reader_.ReadLiteral(6);
755 loop_filter.sharpness = reader_.ReadLiteral(3); 755 loop_filter.sharpness = reader_.ReadLiteral(3);
756 loop_filter.delta_update = false; 756 loop_filter.delta_update = false;
757 757
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 } 1028 }
1029 1029
1030 if (fhdr->error_resilient_mode) { 1030 if (fhdr->error_resilient_mode) {
1031 fhdr->refresh_frame_context = false; 1031 fhdr->refresh_frame_context = false;
1032 fhdr->frame_parallel_decoding_mode = true; 1032 fhdr->frame_parallel_decoding_mode = true;
1033 } else { 1033 } else {
1034 fhdr->refresh_frame_context = reader_.ReadBool(); 1034 fhdr->refresh_frame_context = reader_.ReadBool();
1035 fhdr->frame_parallel_decoding_mode = reader_.ReadBool(); 1035 fhdr->frame_parallel_decoding_mode = reader_.ReadBool();
1036 } 1036 }
1037 1037
1038 static_assert(
1039 arraysize(context_->frame_context_managers) == (1 << 2),
1040 "bits of frame_context_idx doesn't match size of frame_context_managers");
1041 fhdr->frame_context_idx_to_save_probs = fhdr->frame_context_idx = 1038 fhdr->frame_context_idx_to_save_probs = fhdr->frame_context_idx =
1042 reader_.ReadLiteral(2); 1039 reader_.ReadLiteral(kVp9NumFrameContextsLog2);
1043 1040
1044 if (fhdr->IsIntra()) { 1041 if (fhdr->IsIntra()) {
1045 SetupPastIndependence(fhdr); 1042 SetupPastIndependence(fhdr);
1046 if (fhdr->IsKeyframe() || fhdr->error_resilient_mode || 1043 if (fhdr->IsKeyframe() || fhdr->error_resilient_mode ||
1047 fhdr->reset_frame_context == 3) { 1044 fhdr->reset_frame_context == 3) {
1048 for (auto& frame_context_manage : context_->frame_context_managers) 1045 for (size_t i = 0; i < kVp9NumFrameContexts; ++i)
1049 frame_context_manage.Update(fhdr->frame_context); 1046 context_->UpdateFrameContext(i, fhdr->frame_context);
1050 } else if (fhdr->reset_frame_context == 2) { 1047 } else if (fhdr->reset_frame_context == 2) {
1051 context_->frame_context_managers[fhdr->frame_context_idx].Update( 1048 context_->UpdateFrameContext(fhdr->frame_context_idx,
1052 fhdr->frame_context); 1049 fhdr->frame_context);
1053 } 1050 }
1054 fhdr->frame_context_idx = 0; 1051 fhdr->frame_context_idx = 0;
1055 } 1052 }
1056 1053
1057 ReadLoopFilterParams(); 1054 ReadLoopFilterParams();
1058 ReadQuantizationParams(&fhdr->quant_params); 1055 ReadQuantizationParams(&fhdr->quant_params);
1059 if (!ReadSegmentationParams()) 1056 if (!ReadSegmentationParams())
1060 return false; 1057 return false;
1061 1058
1062 if (!ReadTileInfo(fhdr)) 1059 if (!ReadTileInfo(fhdr))
(...skipping 12 matching lines...) Expand all
1075 if (!reader_.IsValid()) { 1072 if (!reader_.IsValid()) {
1076 DVLOG(1) << "parser reads beyond the end of buffer"; 1073 DVLOG(1) << "parser reads beyond the end of buffer";
1077 return false; 1074 return false;
1078 } 1075 }
1079 fhdr->uncompressed_header_size = reader_.GetBytesRead(); 1076 fhdr->uncompressed_header_size = reader_.GetBytesRead();
1080 1077
1081 return true; 1078 return true;
1082 } 1079 }
1083 1080
1084 } // namespace media 1081 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698