3

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?

4
  • 5
    There is no log in your code, but a log2. Why? A guess is that you pass an integer to log and the compiler cannot decide if you want a float or double result. Commented Apr 4, 2012 at 14:53
  • 1
    possible duplicate of error c2668 ambiguous call to overloaded function (from same user) Commented Apr 4, 2012 at 17:02
  • the call to log is originated from where ? Commented Aug 14, 2012 at 8:43
  • I think this is a known thing with VS(idk if it is std behavior or not), if you can just do the explicit cast... Commented Oct 16, 2012 at 13:09

2 Answers 2

0

Modify your calls to log2 to look like this:

log2( (double)(pps->num_slice_groups_minus1 + 1) ) 
Sign up to request clarification or add additional context in comments.

Comments

0

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 )

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.