user1312155
user1312155

Reputation: 173

Error C2668 ambiguous call to overloaded function code from site http://h264bitstream.sourceforge.net/

I ran a h264 parser program downloaded from the site http://h264bitstream.sourceforge.net/

when I run the code i get the following errors

error C2668: 'log' : ambiguous call to overloaded function
1> c:\program files\microsoft visual studio 10.0\vc\include\math.h(575): could be 'long double log(long double)'
1> c:\program files\microsoft visual studio 10.0\vc\include\math.h(527): or 'float log(float)'
1> c:\program files\microsoft visual studio 10.0\vc\include\math.h(120): or 'double log(double)'

in the following piece of code

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)**
            }
        }
    }

error C2668: 'log' : ambiguous call to overloaded function 1> c:\program files\microsoft visual studio 10.0\vc\include\math.h(575): could be 'long double log(long double)'
1> c:\program files\microsoft visual studio 10.0\vc\include\math.h(527): or 'float log(float)'
1> c:\program files\microsoft visual studio 10.0\vc\include\math.h(120): or 'double log(double)'
1> while trying to match the argument list '(int)' in the following piece of code

 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?**
    }

error C2668: 'log' : ambiguous call to overloaded function 1> c:\program files\microsoft visual studio 10.0\vc\include\math.h(575): could be 'long double log(long double)'
1> c:\program files\microsoft visual studio 10.0\vc\include\math.h(527): or 'float log(float)'
1> c:\program files\microsoft visual studio 10.0\vc\include\math.h(120): or 'double log(double)'
1> while trying to match the argument list '(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)**
            }
        }

What should I do to resolve it?

Upvotes: 3

Views: 5357

Answers (2)

Guest Aylene
Guest Aylene

Reputation: 1

Try to use 1.0 instead of 1 as Parameter Input. The parameter of your log(...) is expecting to be a double, float or long double variable type. Your variable num_slice_groups_minus1 should be also in double, float or long double, if it's not the case.

Example: log2( pps->num_slice_groups_minus1 + 1.0 )

Upvotes: 0

Dave
Dave

Reputation: 21

Modify your calls to log2 to look like this:

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

Upvotes: 0

Related Questions