blob: 74cce183e7c56678b2417b9955619b0e8bd75186 [file] [log] [blame]
Ray Essick1831f7b2021-03-15 16:10:51 -07001/*
2 * Copyright 2021, The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef LIBMEDIAFORMATSHAPER_VQOPS_H_
18#define LIBMEDIAFORMATSHAPER_VQOPS_H_
19
Ray Essick7b4e9d92021-04-20 16:48:00 -070020#include "CodecProperties.h"
Ray Essick1831f7b2021-03-15 16:10:51 -070021#include <media/NdkMediaFormat.h>
22
23namespace android {
24namespace mediaformatshaper {
25
26// parameterized info for the different mediaType types
27typedef struct {
28 const char *mediaType;
29
30 int32_t qpMin; // codec type limit (e.g. h264, not c2.android.avc.encoder)
31 int32_t qpMax;
32 int32_t qpDelta; // from I to P to B
33
34} vqOps_t;
35
36int VQApply(CodecProperties *codec, vqOps_t *info, AMediaFormat* inFormat, int flags);
37
38// spread the overall QP setting to any un-set per-frame-type settings
39void qpSpreadPerFrameType(AMediaFormat *format, int delta, int qplow, int qphigh, bool override);
40void qpSpreadMaxPerFrameType(AMediaFormat *format, int delta, int qphigh, bool override);
41void qpSpreadMinPerFrameType(AMediaFormat *format, int qplow, bool override);
Ray Essick7b4e9d92021-04-20 16:48:00 -070042void qpVerifyMinMaxOrdering(AMediaFormat *format);
Ray Essick1831f7b2021-03-15 16:10:51 -070043
44// does the format have QP bounding entries
Ray Essick7b4e9d92021-04-20 16:48:00 -070045bool hasQpMax(AMediaFormat *format);
46bool hasQpMaxGlobal(AMediaFormat *format);
47bool hasQpMaxPerFrameType(AMediaFormat *format);
Ray Essick1831f7b2021-03-15 16:10:51 -070048
49} // namespace mediaformatshaper
50} // namespace android
51
52#endif // LIBMEDIAFORMATSHAPER_VQOPS_H_