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

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

Issue 2538883002: 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
114 private: 126 private:
115 // We need to keep at most kDPBMaxSize pictures in DPB for 127 // We need to keep at most kDPBMaxSize pictures in DPB for
116 // reference/to display later and an additional one for the one currently 128 // 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 129 // 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 130 // 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 131 // displaying and giving them back. +2 instead of +1 because of subjective
120 // smoothness improvement during testing. 132 // smoothness improvement during testing.
121 enum { 133 enum {
122 kPicsInPipeline = limits::kMaxVideoFrames + 2, 134 kPicsInPipeline = limits::kMaxVideoFrames + 2,
123 kMaxNumReqPictures = H264DPB::kDPBMaxSize + kPicsInPipeline, 135 kMaxNumReqPictures = H264DPB::kDPBMaxSize + kPicsInPipeline,
124 }; 136 };
125 137
126 // Internal state of the decoder. 138 // Internal state of the decoder.
127 enum State { 139 enum State {
128 kNeedStreamMetadata, // After initialization, need an SPS. 140 kNeedStreamMetadata, // After initialization, need an SPS.
129 kDecoding, // Ready to decode from any point. 141 kDecoding, // Ready to decode from any point.
130 kAfterReset, // After Reset(), need a resume point. 142 kAfterReset, // After Reset(), need a resume point.
131 kError, // Error in decode, can't continue. 143 kError, // Error in decode, can't continue.
132 }; 144 };
133 145
134 // Process H264 stream structures. 146 // Process H264 stream structures.
135 bool ProcessSPS(int sps_id, bool* need_new_buffers); 147 bool ProcessSPS(int sps_id, bool* need_new_buffers);
136 // Process current slice header to discover if we need to start a new picture, 148 // Process current slice header to discover if we need to start a new picture,
137 // finishing up the current one. 149 // finishing up the current one.
138 bool PreprocessCurrentSlice(); 150 bool PreprocessCurrentSlice();
139 // Process current slice as a slice of the current picture. 151 // Process current slice as a slice of the current picture.
140 bool ProcessCurrentSlice(); 152 bool ProcessCurrentSlice();
141 153
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|. 154 // Initialize the current picture according to data in |slice_hdr|.
146 bool InitCurrPicture(const H264SliceHeader* slice_hdr); 155 bool InitCurrPicture(const H264SliceHeader* slice_hdr);
147 156
148 // Initialize |pic| as a "non-existing" picture (see spec) with |frame_num|, 157 // Initialize |pic| as a "non-existing" picture (see spec) with |frame_num|,
149 // to be used for frame gap concealment. 158 // to be used for frame gap concealment.
150 bool InitNonexistingPicture(scoped_refptr<H264Picture> pic, int frame_num); 159 bool InitNonexistingPicture(scoped_refptr<H264Picture> pic, int frame_num);
151 160
152 // Calculate picture order counts for |pic| on initialization 161 // Calculate picture order counts for |pic| on initialization
153 // of a new frame (see spec). 162 // of a new frame (see spec).
154 bool CalculatePicOrderCounts(scoped_refptr<H264Picture> pic); 163 bool CalculatePicOrderCounts(scoped_refptr<H264Picture> pic);
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 int last_output_poc_; 280 int last_output_poc_;
272 281
273 H264Accelerator* accelerator_; 282 H264Accelerator* accelerator_;
274 283
275 DISALLOW_COPY_AND_ASSIGN(H264Decoder); 284 DISALLOW_COPY_AND_ASSIGN(H264Decoder);
276 }; 285 };
277 286
278 } // namespace media 287 } // namespace media
279 288
280 #endif // MEDIA_GPU_H264_DECODER_H_ 289 #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