blob: 2adbca9b7122e396bb2b804776983c8ae1b433c2 [file] [log] [blame]
asapersson86b01602015-10-20 23:55:26 -07001/*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#include "modules/video_coding/qp_parser.h"
asapersson86b01602015-10-20 23:55:26 -070012
Mirko Bonadei71207422017-09-15 13:58:09 +020013#include "common_types.h" // NOLINT(build/include)
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020014#include "modules/video_coding/utility/vp8_header_parser.h"
15#include "modules/video_coding/utility/vp9_uncompressed_header_parser.h"
asapersson86b01602015-10-20 23:55:26 -070016
17namespace webrtc {
18
19bool QpParser::GetQp(const VCMEncodedFrame& frame, int* qp) {
20 switch (frame.CodecSpecific()->codecType) {
21 case kVideoCodecVP8:
22 // QP range: [0, 127].
23 return vp8::GetQp(frame.Buffer(), frame.Length(), qp);
jianj20acdf22017-05-24 10:00:16 -070024 case kVideoCodecVP9:
25 // QP range: [0, 255].
26 return vp9::GetQp(frame.Buffer(), frame.Length(), qp);
asapersson86b01602015-10-20 23:55:26 -070027 default:
28 return false;
29 }
30}
31
32} // namespace webrtc