bbc / vc2hqencode

Optimised VC-2 HQ Profile Encoder Library
GNU General Public License v2.0
14 stars 4 forks source link

Crash when encoding fragments at lower resolution #5

Open JDarnley opened 6 years ago

JDarnley commented 6 years ago

I was trying to get a fragmented stream so I tried using 1280x720and fragment size of 10000 but I encountered the following crash. This is the same system as in my other issues. It can encode fine at 1080 with that fragment size and at 720 without fragments.

GNU gdb (GDB) 8.0.1
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./testprogs/vc2encode...done.
(gdb) r
Starting program: /home/james/src/vc2hqencode/testprogs/vc2encode --width=1280 --height=720 --fragment=10000
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
INFO: Processor Features:
INFO:   SSE4.2 [ ]
INFO:   AVX    [ ]
INFO:   AVX2   [ ]
INFO: VC2Encoder.cpp:283: Configuring for 1 threads, 4 jobs

[New Thread 0x7ffff66da700 (LWP 31741)]

Thread 1 "vc2encode" received signal SIGSEGV, Segmentation fault.
VC2Encoder::encodeData (this=0x555555825590, idata=<optimized out>, istride=<optimized out>, _odata=0x7fffffffd958, length=1152000, prev_parse_offset=prev_parse_offset@entry=0x7fffffffd954)
    at VC2Encoder.cpp:834
834           mEncoderData[k+1].odata[ 9] = (mEncoderData[k].final_offset >> 24)&0xFF;
(gdb) bt
#0  VC2Encoder::encodeData (this=0x555555825590, idata=<optimized out>, istride=<optimized out>, _odata=0x7fffffffd958, length=1152000,
    prev_parse_offset=prev_parse_offset@entry=0x7fffffffd954) at VC2Encoder.cpp:834
#1  0x0000555555573cc4 in vc2encode_encode_fragmented_data (handle=<optimized out>, idata=<optimized out>, istride=<optimized out>, odata=<optimized out>, length=<optimized out>,
    prev_parse_offset=<optimized out>, next_parse_offset=0x7fffffffd954) at vc2hqencode.cpp:138
#2  0x0000555555560f8b in main (argc=<optimized out>, argv=<optimized out>) at vc2encode.cpp:561

After building with --enable-debug something caught the error ad printed this.

(gdb) r
Starting program: /home/james/src/vc2hqencode/testprogs/vc2encode --width=1280 --height=720 --fragment=10000
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
INFO: Processor Features:
INFO:   SSE4.2 [ ]
INFO:   AVX    [ ]
INFO:   AVX2   [ ]
INFO: VC2Encoder.cpp:283: Configuring for 1 threads, 4 jobs

--------------------------------------------------------------------
   Sequence Header Coded Data
--------------------------------------------------------------------
      0x00000001/ 5  0x00000001/ 1  0x00000001/ 5  0x00000001/ 1
      0x0000002b/ 7  0x00000001/ 1  0x00020003/21  0x0000a203/19
      0x00000000/ 1  0x00000000/ 1  0x00000001/ 1  0x00000001/ 5
      0x00000000/ 1  0x00000000/ 1  0x00000000/ 1  0x00000000/ 1
      0x00000001/ 1
--------------------------------------------------------------------
--------------------------------------------------------------------
   Sequence Header Stream Data
--------------------------------------------------------------------
      42  42  43  44  00  00  00  00  17  00  00  00  00  0c  35  71
      00  01  8a  20  32  10  ff
--------------------------------------------------------------------
--------------------------------------------------------------------
   Picture Header Coded Data
--------------------------------------------------------------------
      0x00000001/ 3  0x00000001/ 5  0x00000000/ 1  0x00000000/ 1
      0x00000083/11  0x0000028b/13  0x00000001/ 1  0x00000003/ 3
      0x00000000/ 1
--------------------------------------------------------------------
--------------------------------------------------------------------
   Picture Header Stream Data
--------------------------------------------------------------------
      42  42  43  44  ec  00  00  00  00  00  00  00  00  00  00  00
      00  00  05  00  00  21  04  18  a2  ed
--------------------------------------------------------------------
ERROR: serialise.hpp:282:  coder overrun
Failed to encode picture
[Inferior 1 (process 27473) exited with code 01]