📄 h263_enc_headers.cpp
字号:
/* /////////////////////////////////////////////////////////////////////////// INTEL CORPORATION PROPRIETARY INFORMATION// This software is supplied under the terms of a license agreement or// nondisclosure agreement with Intel Corporation and may not be copied// or disclosed except in accordance with the terms of that agreement.// Copyright (c) 2005 Intel Corporation. All Rights Reserved.//// Description: class ippVideoEncoderH263 (put headers to bitstream)// Contents:// EncodePicture_Header//*/#include "h263_enc.hpp"void ippVideoEncoderH263::EncodeZeroBitsAlign(){ if (cBS.mBitOff != 0) cBS.PutBits(0, 8 - cBS.mBitOff);}void ippVideoEncoderH263::EncodeStuffingBitsAlign(){ cBS.PutBits(0xFF >> (cBS.mBitOff + 1), 8 - cBS.mBitOff);}void ippVideoEncoderH263::EncodePicture_Header(){ cBS.PutBits(32, 22); cBS.PutBits(VOP.temporal_reference, 8); cBS.PutMarkerBit(); cBS.PutZeroBit(); cBS.PutBits(VOP.split_screen_indicator, 1); cBS.PutBits(VOP.document_camera_indicator, 1); cBS.PutBits(VOP.full_picture_freeze_release, 1); VOP.plusptype = VOP.advIntra || VOP.modQuant || (VOP.UMV > 1) ; // TODO: update when adding modes if (VOP.plusptype) { if (VOP.picture_coding_type == H263_PIC_TYPE_I) VOP.ufep = 1; // ??? if (VOP.UMV == 1) // switch to PLUSPTYPE UMV mode VOP.UMV = 2; } if (!VOP.plusptype) { cBS.PutBits(VOP.source_format, 3); cBS.PutBits(VOP.picture_coding_type, 1); cBS.PutBits(VOP.UMV, 1); cBS.PutBits(VOP.SAC, 1); cBS.PutBits(VOP.advPred, 1); cBS.PutBits(VOP.PBframes, 1); cBS.PutBits(VOP.vop_quant, 5); cBS.PutBits(VOP.CPM, 1); if (VOP.CPM) cBS.PutBits(VOP.PSBI, 1); VOP.vop_rounding_type = 0; } else { // PLUSPTYUPE cBS.PutBits(7, 3); cBS.PutBits(VOP.ufep, 3); if (VOP.ufep == 1) { // OPPTYPE cBS.PutBits(VOP.source_format, 3); cBS.PutBits(VOP.PCF, 1); cBS.PutBits(VOP.UMV ? 1 : 0, 1); cBS.PutBits(VOP.SAC, 1); cBS.PutBits(VOP.advPred, 1); cBS.PutBits(VOP.advIntra, 1); cBS.PutBits(VOP.deblockFilt, 1); cBS.PutBits(VOP.sliceStruct, 1); cBS.PutBits(VOP.RPS, 1); cBS.PutBits(VOP.ISD, 1); cBS.PutBits(VOP.altInterVLC, 1); cBS.PutBits(VOP.modQuant, 1); cBS.PutBits(8, 4); // anti-emulation + 3 reserved } // MPPTYPE cBS.PutBits(VOP.picture_coding_type, 3); cBS.PutBits(VOP.resample, 1); cBS.PutBits(VOP.redResUp, 1); if (VOP.picture_coding_type == H263_PIC_TYPE_P || VOP.picture_coding_type == H263_PIC_TYPE_iPB) VOP.vop_rounding_type ^= 1; cBS.PutBits(VOP.vop_rounding_type, 1); cBS.PutBits(1, 3); // 3 reserved + anti-emulation cBS.PutBits(VOP.CPM, 1); if (VOP.CPM) cBS.PutBits(VOP.PSBI, 1); if (VOP.ufep == 1) { if (VOP.source_format == 6) { int pwhi; cBS.PutBits(VOP.PAR_code, 4); pwhi = (VOP.vop_width >> 2) - 1; cBS.PutBits(pwhi, 9); cBS.PutBits(1, 1); // anti-emulation pwhi = VOP.vop_height >> 2; cBS.PutBits(pwhi, 9); if (VOP.PAR_code == H263_ASPECT_RATIO_EXTPAR) { // cBS.PutBits(VOP.PAR_width, 8); cBS.PutBits(VOP.PAR_height, 8); } } if (VOP.PCF) { cBS.PutBits(VOP.clock_conversion_code, 1); cBS.PutBits(VOP.clock_divisor, 7); } } if (VOP.PCF) cBS.PutBits(VOP.temporal_reference >> 8, 2); if (VOP.ufep == 1) { if (VOP.UMV) cBS.PutBits(1, VOP.UMV - 1); // VOP.UMV == 2 or 3 if (VOP.sliceStruct) cBS.PutBits(VOP.sliceSubmodes, 2); } if (VOP.picture_coding_type == H263_PIC_TYPE_B || VOP.picture_coding_type == H263_PIC_TYPE_EP || VOP.picture_coding_type == H263_PIC_TYPE_EI) { VOP.scalability = 1; cBS.PutBits(VOP.enh_layer_num, 4); if (VOP.ufep == 1) { cBS.PutBits(VOP.ref_layer_num, 4); } }#if 0 // Reference Picture Selection mode if (VOP.RPS) { if (VOP.ufep == 1) cBS.PutBits(VOP.RPSflags, 3); cBS.PutBits(VOP.TRPI, 1); if (VOP.TRPI) cBS.PutBits(VOP.pred_temp_ref, 10); if (VOP.BCI) { cBS.PutBits(1, 1); // EncodeBCM - not implemented yet. TODO ??? } else cBS.PutBits(1, 2); }#endif if (VOP.resample) { cBS.PutBits((VOP.wda | 2), 2); // EncodeResampleParams - not implemented yet. TODO } cBS.PutBits(VOP.vop_quant, 5); } if (VOP.PBframes) { cBS.PutBits(VOP.temporal_reference_B, 3); cBS.PutBits(VOP.dbquant, 2); } cBS.PutZeroBit(); // pei}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -