1 /* 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 20 #include "CodecProperties.h" 21 #include <media/NdkMediaFormat.h> 22 23 namespace android { 24 namespace mediaformatshaper { 25 26 // parameterized info for the different mediaType types 27 typedef 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 36 int 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 39 void qpSpreadPerFrameType(AMediaFormat *format, int delta, int qplow, int qphigh, bool override); 40 void qpSpreadMaxPerFrameType(AMediaFormat *format, int delta, int qphigh, bool override); 41 void qpSpreadMinPerFrameType(AMediaFormat *format, int qplow, bool override); 42 void qpVerifyMinMaxOrdering(AMediaFormat *format); 43 44 // does the format have QP bounding entries 45 bool hasQpMax(AMediaFormat *format); 46 bool hasQpMaxGlobal(AMediaFormat *format); 47 bool hasQpMaxPerFrameType(AMediaFormat *format); 48 49 } // namespace mediaformatshaper 50 } // namespace android 51 52 #endif // LIBMEDIAFORMATSHAPER_VQOPS_H_ 53