从网站http://h264bitstream.sourceforge.net/错误C2668模糊调用重载函数代码

时间:2012-04-04 14:40:15

标签: c++ c visual-studio-2010 visual-c++

我运行了从网站http://h264bitstream.sourceforge.net/

下载的h264解析器程序

当我运行代码时,我得到以下错误

  

错误C2668:'log':对重载函数的模糊调用
  1 GT; c:\ program files \ microsoft visual studio 10.0 \ vc \ include \ math.h(575):可能是'long double log(long double)'

  1 GT; c:\ program files \ microsoft visual studio 10.0 \ vc \ include \ math.h(527):或'float log(float)'

  1 GT; c:\ program files \ microsoft visual studio 10.0 \ vc \ include \ math.h(120):或'double log(double)'

在下面的代码中

else if( pps->slice_group_map_type == 6 )
        {
            pps->pic_size_in_map_units_minus1 = bs_read_ue(b);
            for( i = 0; i <= pps->pic_size_in_map_units_minus1; i++ )
            {
                **pps->slice_group_id[ i ] = bs_read_u(b, ceil( log2( pps->num_slice_groups_minus1 + 1 ) ) ); // was u(v)**
            }
        }
    }
  

错误C2668:'log':对重载函数的模糊调用   1 GT; c:\ program files \ microsoft visual studio 10.0 \ vc \ include \ math.h(575):可能是'long double log(long double)'

  1 GT; c:\ program files \ microsoft visual studio 10.0 \ vc \ include \ math.h(527):或'float log(float)'

  1 GT; c:\ program files \ microsoft visual studio 10.0 \ vc \ include \ math.h(120):或'double log(double)'

  1 GT;在尝试匹配参数列表'(int)'时   在下面的代码中

 if( pps->num_slice_groups_minus1 > 0 &&
        pps->slice_group_map_type >= 3 && pps->slice_group_map_type <= 5)
    {
        sh->slice_group_change_cycle = 
            **bs_read_u(b, ceil( log2( pps->pic_size_in_map_units_minus1 +  
                                     pps->slice_group_change_rate_minus1 + 1 ) ) ); // was u(v) // FIXME add 2?**
    }
  

错误C2668:'log':对重载函数的模糊调用   1 GT; c:\ program files \ microsoft visual studio 10.0 \ vc \ include \ math.h(575):可能是'long double log(long double)'

  1 GT; c:\ program files \ microsoft visual studio 10.0 \ vc \ include \ math.h(527):或'float log(float)'

  1 GT; c:\ program files \ microsoft visual studio 10.0 \ vc \ include \ math.h(120):或'double log(double)'

  1 GT;在尝试匹配参数列表'(int)'

bs_write_ue(b, pps->pic_size_in_map_units_minus1);
            for( i = 0; i <= pps->pic_size_in_map_units_minus1; i++ )
            {
                **bs_write_u(b, ceil( log2( pps->num_slice_groups_minus1 + 1 ) ), pps->slice_group_id[ i ] ); // was u(v)**
            }
        }

我该怎么做才能解决它?

2 个答案:

答案 0 :(得分:0)

修改对log2的调用,如下所示:

log2( (double)(pps->num_slice_groups_minus1 + 1) )

答案 1 :(得分:0)

尝试使用1.0而不是1作为参数输入。您log(...)的参数期望是double,float或long双变量类型。你的变量num_slice_groups_minus1也应该是double,float或long double,如果不是这样的话。

示例:log2( pps->num_slice_groups_minus1 + 1.0 )