mirror of
https://github.com/opencv/opencv_contrib.git
synced 2025-10-19 02:16:34 +08:00
Merge branch 4.x
This commit is contained in:
@@ -100,9 +100,12 @@ void NvEncoder::CreateDefaultEncoderParams(NV_ENC_INITIALIZE_PARAMS* pIntializeP
|
||||
pIntializeParams->enableEncodeAsync = GetCapabilityValue(codecGuid, NV_ENC_CAPS_ASYNC_ENCODE_SUPPORT);
|
||||
#endif
|
||||
pIntializeParams->tuningInfo = tuningInfo;
|
||||
NV_ENC_PRESET_CONFIG presetConfig = {};
|
||||
presetConfig.version = NV_ENC_PRESET_CONFIG_VER;
|
||||
presetConfig.presetCfg.version = NV_ENC_CONFIG_VER;
|
||||
pIntializeParams->encodeConfig->rcParams.rateControlMode = NV_ENC_PARAMS_RC_CONSTQP;
|
||||
#if (NVENCAPI_MAJOR_VERSION >= 12 && NVENCAPI_MINOR_VERSION >= 2)
|
||||
NV_ENC_PRESET_CONFIG presetConfig = { NV_ENC_PRESET_CONFIG_VER, 0, { NV_ENC_CONFIG_VER } };
|
||||
#else
|
||||
NV_ENC_PRESET_CONFIG presetConfig = { NV_ENC_PRESET_CONFIG_VER, { NV_ENC_CONFIG_VER } };
|
||||
#endif
|
||||
m_nvenc.nvEncGetEncodePresetConfigEx(m_hEncoder, codecGuid, presetGuid, tuningInfo, &presetConfig);
|
||||
memcpy(pIntializeParams->encodeConfig, &presetConfig.presetCfg, sizeof(NV_ENC_CONFIG));
|
||||
|
||||
@@ -116,8 +119,13 @@ void NvEncoder::CreateDefaultEncoderParams(NV_ENC_INITIALIZE_PARAMS* pIntializeP
|
||||
}
|
||||
else if (pIntializeParams->encodeGUID == NV_ENC_CODEC_HEVC_GUID)
|
||||
{
|
||||
#if (NVENCAPI_MAJOR_VERSION >= 12 && NVENCAPI_MINOR_VERSION >= 2)
|
||||
pIntializeParams->encodeConfig->encodeCodecConfig.hevcConfig.inputBitDepth = pIntializeParams->encodeConfig->encodeCodecConfig.hevcConfig.outputBitDepth =
|
||||
(m_eBufferFormat == NV_ENC_BUFFER_FORMAT_YUV420_10BIT || m_eBufferFormat == NV_ENC_BUFFER_FORMAT_YUV444_10BIT) ? NV_ENC_BIT_DEPTH_10 : NV_ENC_BIT_DEPTH_8;
|
||||
#else
|
||||
pIntializeParams->encodeConfig->encodeCodecConfig.hevcConfig.pixelBitDepthMinus8 =
|
||||
(m_eBufferFormat == NV_ENC_BUFFER_FORMAT_YUV420_10BIT || m_eBufferFormat == NV_ENC_BUFFER_FORMAT_YUV444_10BIT) ? 2 : 0;
|
||||
#endif
|
||||
if (m_eBufferFormat == NV_ENC_BUFFER_FORMAT_YUV444 || m_eBufferFormat == NV_ENC_BUFFER_FORMAT_YUV444_10BIT)
|
||||
{
|
||||
pIntializeParams->encodeConfig->encodeCodecConfig.hevcConfig.chromaFormatIDC = 3;
|
||||
@@ -171,7 +179,11 @@ void NvEncoder::CreateEncoder(const NV_ENC_INITIALIZE_PARAMS* pEncoderParams)
|
||||
if (pEncoderParams->encodeGUID == NV_ENC_CODEC_HEVC_GUID)
|
||||
{
|
||||
bool yuv10BitFormat = (m_eBufferFormat == NV_ENC_BUFFER_FORMAT_YUV420_10BIT || m_eBufferFormat == NV_ENC_BUFFER_FORMAT_YUV444_10BIT) ? true : false;
|
||||
#if (NVENCAPI_MAJOR_VERSION >= 12 && NVENCAPI_MINOR_VERSION >= 2)
|
||||
if (yuv10BitFormat && pEncoderParams->encodeConfig->encodeCodecConfig.hevcConfig.inputBitDepth != NV_ENC_BIT_DEPTH_10)
|
||||
#else
|
||||
if (yuv10BitFormat && pEncoderParams->encodeConfig->encodeCodecConfig.hevcConfig.pixelBitDepthMinus8 != 2)
|
||||
#endif
|
||||
{
|
||||
NVENC_THROW_ERROR("Invalid PixelBitdepth", NV_ENC_ERR_INVALID_PARAM);
|
||||
}
|
||||
@@ -193,12 +205,20 @@ void NvEncoder::CreateEncoder(const NV_ENC_INITIALIZE_PARAMS* pEncoderParams)
|
||||
}
|
||||
else
|
||||
{
|
||||
NV_ENC_PRESET_CONFIG presetConfig = {};
|
||||
presetConfig.version = NV_ENC_PRESET_CONFIG_VER;
|
||||
presetConfig.presetCfg.version = NV_ENC_CONFIG_VER;
|
||||
#if (NVENCAPI_MAJOR_VERSION >= 12 && NVENCAPI_MINOR_VERSION >= 2)
|
||||
NV_ENC_PRESET_CONFIG presetConfig = { NV_ENC_PRESET_CONFIG_VER, 0, { NV_ENC_CONFIG_VER } };
|
||||
#else
|
||||
NV_ENC_PRESET_CONFIG presetConfig = { NV_ENC_PRESET_CONFIG_VER, { NV_ENC_CONFIG_VER } };
|
||||
#endif
|
||||
m_nvenc.nvEncGetEncodePresetConfigEx(m_hEncoder, pEncoderParams->encodeGUID, pEncoderParams->presetGUID, pEncoderParams->tuningInfo, &presetConfig);
|
||||
memcpy(&m_encodeConfig, &presetConfig.presetCfg, sizeof(NV_ENC_CONFIG));
|
||||
}
|
||||
|
||||
if (((uint32_t)m_encodeConfig.frameIntervalP) > m_encodeConfig.gopLength)
|
||||
{
|
||||
m_encodeConfig.frameIntervalP = m_encodeConfig.gopLength;
|
||||
}
|
||||
|
||||
m_initializeParams.encodeConfig = &m_encodeConfig;
|
||||
NVENC_API_CALL(m_nvenc.nvEncInitializeEncoder(m_hEncoder, &m_initializeParams));
|
||||
m_bEncoderInitialized = true;
|
||||
|
@@ -60,7 +60,7 @@ public class MSDFeatureDetectorTest extends OpenCVTestCase {
|
||||
|
||||
detector.write(filename);
|
||||
|
||||
String truth = "%YAML:1.0\n---\nname: \"Feature2D.MSD\"\npatch_radius: 3\nsearch_area_radius: 5\nnms_radius: 5\nnms_scale_radius: 0\nth_saliency: 250.\nkNN: 4\nscale_factor: 1.2500000000000000e+00\nn_scales: -1\ncompute_orientation: 0\n";
|
||||
String truth = "%YAML:1.0\n---\nname: \"Feature2D.MSD\"\npatch_radius: 3\nsearch_area_radius: 5\nnms_radius: 5\nnms_scale_radius: 0\nth_saliency: 250.\nkNN: 4\nscale_factor: 1.25\nn_scales: -1\ncompute_orientation: 0\n";
|
||||
String actual = readFile(filename);
|
||||
actual = actual.replaceAll("e([+-])0(\\d\\d)", "e$1$2"); // NOTE: workaround for different platforms double representation
|
||||
assertEquals(truth, actual);
|
||||
|
@@ -2592,7 +2592,7 @@ void EdgeDrawingImpl::detectEllipses(OutputArray ellipses)
|
||||
}
|
||||
|
||||
// This is how much space we will allocate for circles buffers
|
||||
int maxNoOfCircles = (int)lines.size() / 3 + noCircles1 * 2;
|
||||
int maxNoOfCircles = (int)lines.size() / 3 + noCircles1 * 2 + 2;
|
||||
|
||||
edarcs1 = new EDArcs(maxNoOfCircles);
|
||||
DetectArcs(); // Detect all arcs
|
||||
|
@@ -581,7 +581,7 @@ void FastLineDetectorImpl::lineDetection(const Mat& src, std::vector<SEGMENT>& s
|
||||
bool is_merged = false;
|
||||
int ith = (int)segments_tmp.size() - 1;
|
||||
int jth = ith - 1;
|
||||
while(ith > 1 || jth > 0)
|
||||
while(ith > 1 || jth >= 0)
|
||||
{
|
||||
seg1 = segments_tmp[ith];
|
||||
seg2 = segments_tmp[jth];
|
||||
|
Reference in New Issue
Block a user