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

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

Issue 2538883002: Detect H264 slices of the same frame in VEAUnittest (Closed)
Patch Set: Refactor into static methods. Created 4 years 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 (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 int curr_sps_id,
118 const H264Parser& parser,
119 const H264SliceHeader* slice_hdr);
120
121 // Return true if we can initialize |pic| with the given info.
122 static bool InitPictureFromSliceHeader(int curr_sps_id,
123 const H264Parser& parser,
124 const H264SliceHeader* slice_hdr,
125 scoped_refptr<H264Picture> pic);
126
114 private: 127 private:
115 // We need to keep at most kDPBMaxSize pictures in DPB for 128 // We need to keep at most kDPBMaxSize pictures in DPB for
116 // reference/to display later and an additional one for the one currently 129 // reference/to display later and an additional one for the one currently
117 // being decoded. We also ask for some additional ones since VDA needs 130 // being decoded. We also ask for some additional ones since VDA needs
118 // to accumulate a few ready-to-output pictures before it actually starts 131 // to accumulate a few ready-to-output pictures before it actually starts
119 // displaying and giving them back. +2 instead of +1 because of subjective 132 // displaying and giving them back. +2 instead of +1 because of subjective
120 // smoothness improvement during testing. 133 // smoothness improvement during testing.
121 enum { 134 enum {
122 kPicsInPipeline = limits::kMaxVideoFrames + 2, 135 kPicsInPipeline = limits::kMaxVideoFrames + 2,
123 kMaxNumReqPictures = H264DPB::kDPBMaxSize + kPicsInPipeline, 136 kMaxNumReqPictures = H264DPB::kDPBMaxSize + kPicsInPipeline,
124 }; 137 };
125 138
126 // Internal state of the decoder. 139 // Internal state of the decoder.
127 enum State { 140 enum State {
128 kNeedStreamMetadata, // After initialization, need an SPS. 141 kNeedStreamMetadata, // After initialization, need an SPS.
129 kDecoding, // Ready to decode from any point. 142 kDecoding, // Ready to decode from any point.
130 kAfterReset, // After Reset(), need a resume point. 143 kAfterReset, // After Reset(), need a resume point.
131 kError, // Error in decode, can't continue. 144 kError, // Error in decode, can't continue.
132 }; 145 };
133 146
134 // Process H264 stream structures. 147 // Process H264 stream structures.
135 bool ProcessSPS(int sps_id, bool* need_new_buffers); 148 bool ProcessSPS(int sps_id, bool* need_new_buffers);
136 // Process current slice header to discover if we need to start a new picture, 149 // Process current slice header to discover if we need to start a new picture,
137 // finishing up the current one. 150 // finishing up the current one.
138 bool PreprocessCurrentSlice(); 151 bool PreprocessCurrentSlice();
139 // Process current slice as a slice of the current picture. 152 // Process current slice as a slice of the current picture.
140 bool ProcessCurrentSlice(); 153 bool ProcessCurrentSlice();
141 154
142 // Return true if we need to start a new picture.
143 bool IsNewPrimaryCodedPicture(const H264SliceHeader* slice_hdr) const;
144
145 // Initialize the current picture according to data in |slice_hdr|. 155 // Initialize the current picture according to data in |slice_hdr|.
146 bool InitCurrPicture(const H264SliceHeader* slice_hdr); 156 bool InitCurrPicture(const H264SliceHeader* slice_hdr);
147 157
148 // Initialize |pic| as a "non-existing" picture (see spec) with |frame_num|, 158 // Initialize |pic| as a "non-existing" picture (see spec) with |frame_num|,
149 // to be used for frame gap concealment. 159 // to be used for frame gap concealment.
150 bool InitNonexistingPicture(scoped_refptr<H264Picture> pic, int frame_num); 160 bool InitNonexistingPicture(scoped_refptr<H264Picture> pic, int frame_num);
151 161
152 // Calculate picture order counts for |pic| on initialization 162 // Calculate picture order counts for |pic| on initialization
153 // of a new frame (see spec). 163 // of a new frame (see spec).
154 bool CalculatePicOrderCounts(scoped_refptr<H264Picture> pic); 164 bool CalculatePicOrderCounts(scoped_refptr<H264Picture> pic);
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 int last_output_poc_; 281 int last_output_poc_;
272 282
273 H264Accelerator* accelerator_; 283 H264Accelerator* accelerator_;
274 284
275 DISALLOW_COPY_AND_ASSIGN(H264Decoder); 285 DISALLOW_COPY_AND_ASSIGN(H264Decoder);
276 }; 286 };
277 287
278 } // namespace media 288 } // namespace media
279 289
280 #endif // MEDIA_GPU_H264_DECODER_H_ 290 #endif // MEDIA_GPU_H264_DECODER_H_
OLDNEW
« no previous file with comments | « media/gpu/BUILD.gn ('k') | media/gpu/h264_decoder.cc » ('j') | media/gpu/h264_decoder.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698