blob: 2adbca9b7122e396bb2b804776983c8ae1b433c2 [file] [log] [blame]
asapersson86b01602015-10-21 06:55:261/*
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 04:47:3111#include "modules/video_coding/qp_parser.h"
asapersson86b01602015-10-21 06:55:2612
Mirko Bonadei71207422017-09-15 11:58:0913#include "common_types.h" // NOLINT(build/include)
Mirko Bonadei92ea95e2017-09-15 04:47:3114#include "modules/video_coding/utility/vp8_header_parser.h"
15#include "modules/video_coding/utility/vp9_uncompressed_header_parser.h"
asapersson86b01602015-10-21 06:55:2616
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 17:00:1624 case kVideoCodecVP9:
25 // QP range: [0, 255].
26 return vp9::GetQp(frame.Buffer(), frame.Length(), qp);
asapersson86b01602015-10-21 06:55:2627 default:
28 return false;
29 }
30}
31
32} // namespace webrtc