Monorail Project: webm Issues People Development process History Sign in
New issue
Advanced search Search tips
Issue 456 Division by zero when calling vpx_codec_encode
Starred by 6 users Reported by, Jun 15 2012 Back to list
Status: Available
Owner: ----

Sign in to add a comment
When calling vpx_codec_encode for the first time (after the codec initialization), I get a division by zero. This happens only when compressing a specific image. For other images, it works without any problem.

This are the changes I made to the codec configuration
vpxConfig.g_h = 320;
vpxConfig.g_w = 240;
vpxConfig.g_threads = 1;
vpxConfig.rc_target_bitrate = 256;

I use windows binaries (libvpx version 1.1) with c++/VS2010 (win7 x86).

After a close inspection, it seems that the problem is in the function estimate_keyframe_frequency from ratectrl.c. It returns 0 when called from vp8_adjust_key_frame_context.

In my case, cpi->output_frame_rate (ratectrl.c, line 1395) is 0.75. The code, as written, will return 0 (conversion to int is done before multiplication by 2). For my case, a simple correction is to chage line 1395 to 
av_key_frame_frequency = (int)(cpi->output_frame_rate * 2);

Nevertheless, this does not guarantee that av_key_frame_frequency is never 0 (for output_frame_rate<0.5). I think that an additional condition must be added, but I do not have enough understanding of the whole code to provide one.

Project Member Comment 1 by, Jul 19 2012
Labels: Mstone-12
Status: Available
Sign in to add a comment