Hello,
In divx plugin costructor, there are many uninitialized local variables,
used as attribute placeholders. Unfortunately, when the parameter is
unsupported (i.e. OBMC, BiDirectional and others), random value is
copied into the encoder configuration. Especially seting bogus OBMC
causes the codec to produce invalid data. This patch corrects this
behavior by setting initial values of these variables to zero.
--
Jindrich Makovicka
--- orig/divx4.cpp Thu May 2 20:12:56 2002
+++ divx4.cpp Tue May 28 08:35:28 2002
@@ -421,10 +421,10 @@
// fast deinterlace
GetAttrInt(m_Info, divx4str_deinterlace, param.deinterlace);
// use bidirectional coding
- int bidirect;
+ int bidirect = 0;
GetAttrInt(m_Info, divx4str_bidirect, bidirect);
// flag to enable overlapped block motion compensation mode
- int obmc;
+ int obmc = 0;
GetAttrInt(m_Info, divx4str_obmc, obmc);
#ifndef ENCORE_MAJOR_VERSION
param.use_bidirect = bidirect;
@@ -434,7 +434,7 @@
#else
param.extensions.use_bidirect = bidirect;
param.extensions.obmc = obmc;
-
+
#if ENCORE_MAJOR_VERSION >= 5010
GetAttrInt(m_Info, divx4str_enable_crop, param.extensions.enable_crop);
@@ -447,19 +447,22 @@
GetAttrInt(m_Info, divx4str_resize_width, param.extensions.resize_width);
GetAttrInt(m_Info, divx4str_resize_height, param.extensions.resize_height);
GetAttrInt(m_Info, divx4str_resize_mode, param.extensions.resize_mode);
- int tmp;
+ int tmp = 0;
GetAttrInt(m_Info, divx4str_resize_bicubic_B, tmp);
param.extensions.bicubic_B = tmp / (double) 1000.0;
+ tmp = 0;
GetAttrInt(m_Info, divx4str_resize_bicubic_C, tmp);
param.extensions.bicubic_C = tmp / (double) 1000.0;
GetAttrInt(m_Info, divx4str_interlace_mode, param.extensions.interlace_mode);
GetAttrInt(m_Info, divx4str_temporal_enable, param.extensions.temporal_enable);
+ tmp = 0;
GetAttrInt(m_Info, divx4str_temporal_level, tmp);
param.extensions.temporal_level = tmp / (double) 1000.0;
GetAttrInt(m_Info, divx4str_spatial_passes, param.extensions.spatial_passes);
+ tmp = 0;
GetAttrInt(m_Info, divx4str_spatial_level, tmp);
param.extensions.spatial_level = tmp / (double) 1000.0;