blob: 26b46f17fbfc3161a9c511cfbb02a95427eee6a3 [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
kjellandera8d8aad2017-03-08 05:42:26 -080011#include "webrtc/modules/video_coding/qp_parser.h"
asapersson86b01602015-10-20 23:55:26 -070012
13#include "webrtc/common_types.h"
kjellander@webrtc.orgb7ce9642015-11-18 23:04:10 +010014#include "webrtc/modules/video_coding/utility/vp8_header_parser.h"
jianj20acdf22017-05-24 10:00:16 -070015#include "webrtc/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