Philip Heron
2009-Jun-11 16:25 UTC
[theora-dev] Thusnelda - Floating point exception in encoder_toplevel.c:209
Hi all, I've been hitting the odd floating point exception errors using the new alpha encoders. They're encoding a live stream so I can't reproduce the crash on demand, and it might only happen once every few days so it's been fun trying to get a backtrace. The crash happens in a fairly scary block of code, I wouldn't have a clue where to begin trying to fix it! Here's what gdb has to say about it: -- #0 0x00007f8d0e3ce515 in oc_enc_select_qi (cpi=0x7f8d0c14f010, _qti=<value optimized out>, _trial=0) at enc/encoder_toplevel.c:209 209 rderiv=nframes[_qti]*KEY_RATIO[_qti]+drscale; Missing separate debuginfos, use: debuginfo-install SDL-1.2.13-7.fc10.x86_64 alsa-lib-1.0.20-1.fc10.x86_64 freetype-2.3.7-3.fc10.x86_64 glibc-2.9-3.x86_64 libjpeg-6b-43.fc10.x86_64 libogg-1.1.3-9.fc9.x86_64 libshout-2.2.2-3.fc9.x86_64 libvorbis-1.2.0-5.fc10.x86_64 speex-1.2-0.10.rc1.fc10.x86_64 (gdb) print nframes $1 = {0, 183} (gdb) print KEY_RATIO $2 = " \021" (gdb) print _qti $3 = <value optimized out> (gdb) print drscale No symbol "drscale" in current context. (gdb) backtrace #0 0x00007f8d0e3ce515 in oc_enc_select_qi (cpi=0x7f8d0c14f010, _qti=<value optimized out>, _trial=0) at enc/encoder_toplevel.c:209 #1 0x00007f8d0e3d036a in CompressFrame (cpi=0x7f8d0c14f010, recode=0) at enc/encoder_toplevel.c:278 #2 0x00007f8d0e3d08ce in theora_encode_YUVin (t=0x7fff1660eb00, yuv=0x7fff1660ecb8) at enc/encoder_toplevel.c:473 #3 0x0000000000403a29 in l3_theora_encode (s=0x7fff1660e8e0, im=<value optimized out>, eos=0) at live3.c:636 #4 0x0000000000405696 in main (argc=<value optimized out>, argv=<value optimized out>) at live3.c:1403 -- Any ideas? -Phil
Timothy B. Terriberry
2009-Jun-11 17:03 UTC
[theora-dev] Thusnelda - Floating point exception in encoder_toplevel.c:209
Philip Heron wrote:> Any ideas?My guess is that you're running out of bits in the buffer, and rate_total is greater than zero, but less than buf_delay (e.g., less than 1 bit per frame). This one is clearly my fault, try the following patch, and let me know if it fixes the problem: --- encoder_toplevel.c (revision 16089) +++ encoder_toplevel.c (working copy) @@ -177,7 +177,7 @@ if(cpi->dup_count>0)nframes[1]=(nframes[1]+cpi->dup_count)/(cpi->dup_count+1); /*If there aren't enough bits to achieve our desired fullness level, use the minimum quality permitted.*/ - if(rate_total<=0)log_qtarget=OC_QUANT_MAX_LOG; + if(rate_total<=buf_delay)log_qtarget=OC_QUANT_MAX_LOG; else{ static const unsigned char KEY_RATIO[2]={32,17}; ogg_int64_t log_scale0; I know it's difficult to collect, but a test case that can reliably reproduce this would be enormously helpful.