yuvfileparams.cpp
来自「JMVM MPEG MVC/3DAV 测试平台 国际通用标准」· C++ 代码 · 共 57 行
CPP
57 行
#include "YUVFileParams.h"
#include "H264AVCCommonLib.h"
#include "H264AVCCommonLib/CommonDefs.h"
#include <iostream>
// ----------------------------------------------------------------------
//
// FUNCTION: YUVFileParams::YUVFileParams
//
// INPUTS: fileName: Name of file to read from.
// height, width: Frame height and width.
//
// PURPOSE: This constructor derives the parameters required to
// read a frame into a PicBuffer object from the frame
// height and width.
//
// MODIFIED: Tue Mar 14, 2006
//
// ----------------------------------------------------------------------
YUVFileParams::YUVFileParams(const std::string& fileName, const int view_id,
const int height, const int width)
:_fileName(fileName),_view_id(view_id), _height(height), _width(width),
_lumaSize( (_height + 2*YUV_Y_MARGIN)*(_width + 2*YUV_X_MARGIN) ),
_bufSize( 3 * _lumaSize / 2 ),
_lumaOffset( (_width + 2*YUV_X_MARGIN) * YUV_Y_MARGIN + YUV_X_MARGIN ),
_cbOffset( ((_width/2) + YUV_X_MARGIN) * YUV_Y_MARGIN/2 + YUV_X_MARGIN/2
+ _lumaSize ),
_crOffset( ((_width/2) + YUV_X_MARGIN) * YUV_Y_MARGIN/2
+ YUV_X_MARGIN/2 + 5*_lumaSize/4 ),
_stride( _width + 2*YUV_X_MARGIN ) {
if (0 == height || 0 == width) {
std::cerr
<< "Attempted to construct a YUVFileParams object with " << std::endl
<< "either height or width of 0. Did you make sure to " << std::endl
<< "put the AddViewRef keywords in the config file " << std::endl
<< "AFTER the SourceWidth and SourceHeight keywords. " << std::endl;
abort();
}
}
YUVFileParams::YUVFileParams(const YUVFileParams& other) {
_fileName = other._fileName;
_view_id = other._view_id;
_height = other._height;
_width = other._width;
_lumaSize = other._lumaSize;
_bufSize = other._bufSize;
_lumaOffset = other._lumaOffset;
_cbOffset = other._cbOffset;
_crOffset = other._crOffset;
_stride = other._stride;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?