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

Side by Side Diff: media/gpu/h264_decoder.h

Issue 2707793002: Revert of Detect H264 slices of the same frame in VEAUnittest (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « media/gpu/BUILD.gn ('k') | media/gpu/h264_decoder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef MEDIA_GPU_H264_DECODER_H_ 5 #ifndef MEDIA_GPU_H264_DECODER_H_
6 #define MEDIA_GPU_H264_DECODER_H_ 6 #define MEDIA_GPU_H264_DECODER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 ~H264Decoder() override; 104 ~H264Decoder() override;
105 105
106 // AcceleratedVideoDecoder implementation. 106 // AcceleratedVideoDecoder implementation.
107 bool Flush() override WARN_UNUSED_RESULT; 107 bool Flush() override WARN_UNUSED_RESULT;
108 void Reset() override; 108 void Reset() override;
109 void SetStream(const uint8_t* ptr, size_t size) override; 109 void SetStream(const uint8_t* ptr, size_t size) override;
110 DecodeResult Decode() override WARN_UNUSED_RESULT; 110 DecodeResult Decode() override WARN_UNUSED_RESULT;
111 gfx::Size GetPicSize() const override; 111 gfx::Size GetPicSize() const override;
112 size_t GetRequiredNumOfPictures() const override; 112 size_t GetRequiredNumOfPictures() const override;
113 113
114 // Return true if we need to start a new picture.
115 static bool IsNewPrimaryCodedPicture(scoped_refptr<H264Picture> curr_pic,
116 int curr_pps_id,
117 const H264SPS* sps,
118 const H264SliceHeader& slice_hdr);
119
120 // Create a H264Picture from given params. Return nullptr when there is an
121 // error.
122 static scoped_refptr<H264Picture> CreateH264PictureFromSliceHeader(
123 const H264SPS* sps,
124 const H264SliceHeader& slice_hdr);
125
126 private: 114 private:
127 // We need to keep at most kDPBMaxSize pictures in DPB for 115 // We need to keep at most kDPBMaxSize pictures in DPB for
128 // reference/to display later and an additional one for the one currently 116 // reference/to display later and an additional one for the one currently
129 // being decoded. We also ask for some additional ones since VDA needs 117 // being decoded. We also ask for some additional ones since VDA needs
130 // to accumulate a few ready-to-output pictures before it actually starts 118 // to accumulate a few ready-to-output pictures before it actually starts
131 // displaying and giving them back. +2 instead of +1 because of subjective 119 // displaying and giving them back. +2 instead of +1 because of subjective
132 // smoothness improvement during testing. 120 // smoothness improvement during testing.
133 enum { 121 enum {
134 kPicsInPipeline = limits::kMaxVideoFrames + 2, 122 kPicsInPipeline = limits::kMaxVideoFrames + 2,
135 kMaxNumReqPictures = H264DPB::kDPBMaxSize + kPicsInPipeline, 123 kMaxNumReqPictures = H264DPB::kDPBMaxSize + kPicsInPipeline,
136 }; 124 };
137 125
138 // Internal state of the decoder. 126 // Internal state of the decoder.
139 enum State { 127 enum State {
140 kNeedStreamMetadata, // After initialization, need an SPS. 128 kNeedStreamMetadata, // After initialization, need an SPS.
141 kDecoding, // Ready to decode from any point. 129 kDecoding, // Ready to decode from any point.
142 kAfterReset, // After Reset(), need a resume point. 130 kAfterReset, // After Reset(), need a resume point.
143 kError, // Error in decode, can't continue. 131 kError, // Error in decode, can't continue.
144 }; 132 };
145 133
146 // Process H264 stream structures. 134 // Process H264 stream structures.
147 bool ProcessSPS(int sps_id, bool* need_new_buffers); 135 bool ProcessSPS(int sps_id, bool* need_new_buffers);
148 // Process current slice header to discover if we need to start a new picture, 136 // Process current slice header to discover if we need to start a new picture,
149 // finishing up the current one. 137 // finishing up the current one.
150 bool PreprocessCurrentSlice(); 138 bool PreprocessCurrentSlice();
151 // Process current slice as a slice of the current picture. 139 // Process current slice as a slice of the current picture.
152 bool ProcessCurrentSlice(); 140 bool ProcessCurrentSlice();
153 141
142 // Return true if we need to start a new picture.
143 bool IsNewPrimaryCodedPicture(const H264SliceHeader* slice_hdr) const;
144
154 // Initialize the current picture according to data in |slice_hdr|. 145 // Initialize the current picture according to data in |slice_hdr|.
155 bool InitCurrPicture(const H264SliceHeader* slice_hdr); 146 bool InitCurrPicture(const H264SliceHeader* slice_hdr);
156 147
157 // Initialize |pic| as a "non-existing" picture (see spec) with |frame_num|, 148 // Initialize |pic| as a "non-existing" picture (see spec) with |frame_num|,
158 // to be used for frame gap concealment. 149 // to be used for frame gap concealment.
159 bool InitNonexistingPicture(scoped_refptr<H264Picture> pic, int frame_num); 150 bool InitNonexistingPicture(scoped_refptr<H264Picture> pic, int frame_num);
160 151
161 // Calculate picture order counts for |pic| on initialization 152 // Calculate picture order counts for |pic| on initialization
162 // of a new frame (see spec). 153 // of a new frame (see spec).
163 bool CalculatePicOrderCounts(scoped_refptr<H264Picture> pic); 154 bool CalculatePicOrderCounts(scoped_refptr<H264Picture> pic);
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 int last_output_poc_; 271 int last_output_poc_;
281 272
282 H264Accelerator* accelerator_; 273 H264Accelerator* accelerator_;
283 274
284 DISALLOW_COPY_AND_ASSIGN(H264Decoder); 275 DISALLOW_COPY_AND_ASSIGN(H264Decoder);
285 }; 276 };
286 277
287 } // namespace media 278 } // namespace media
288 279
289 #endif // MEDIA_GPU_H264_DECODER_H_ 280 #endif // MEDIA_GPU_H264_DECODER_H_
OLDNEW
« no previous file with comments | « media/gpu/BUILD.gn ('k') | media/gpu/h264_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698