[Ffmpeg-cvslog] r6062 - trunk/libavcodec/mpegaudiodec.c

Aurelien Jacobs aurel
Thu Aug 24 23:10:47 CEST 2006


On Thu, 24 Aug 2006 08:57:33 +0200 (CEST)
michael <subversion at mplayerhq.hu> wrote:

> Author: michael
> Date: Thu Aug 24 08:57:32 2006
> New Revision: 6062
> 
> Modified:
>    trunk/libavcodec/mpegaudiodec.c
> 
> Log:
> dont copy the whole GetBitContext around
> 
> 
> Modified: trunk/libavcodec/mpegaudiodec.c
> ==============================================================================
> --- trunk/libavcodec/mpegaudiodec.c	(original)
> +++ trunk/libavcodec/mpegaudiodec.c	Thu Aug 24 08:57:32 2006
> @@ -1671,7 +1671,7 @@
>  {
>      int s_index;
>      int linbits, code, x, y, l, v, i, j, k, pos;
> -    GetBitContext last_gb;
> +    int last_pos;
>      VLC *vlc;
>  
>      /* low frequencies (called big values) */
> @@ -1735,19 +1735,20 @@
>  
>      /* high frequencies */
>      vlc = &huff_quad_vlc[g->count1table_select];
> -    last_gb.buffer = NULL;
> +    last_pos=0;
>      while (s_index <= 572) {
>          pos = get_bits_count(&s->gb);
>          if (pos >= end_pos) {
> -            if (pos > end_pos && last_gb.buffer != NULL) {
> +            if (pos > end_pos && last_pos){
>                  /* some encoders generate an incorrect size for this
>                     part. We must go back into the data */
>                  s_index -= 4;
> -                s->gb = last_gb;
> +                init_get_bits(&s->gb, s->gb.buffer + (last_pos>>3), s->gb.size_in_bits - (last_pos&(~7)));
> +                skip_bits(&s->gb, last_pos&7);
>              }
>              break;
>          }
> -        last_gb= s->gb;
> +        last_pos= pos;
>  
>          code = get_vlc2(&s->gb, vlc->table, vlc->bits, 1);
>          dprintf("t=%d code=%d\n", g->count1table_select, code);

This segfault on arm when using A32_BITSTREAM_READER.
I guess the buffer bitstream buffer need to be 32 bits aligned ??
(can't reproduce on x86)

Here is the traceback:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16384 (LWP 1165)]
0x00295c30 in huffman_decode ()
(gdb) bt
#0  0x00295c30 in huffman_decode ()
#1  0x00296c64 in mp_decode_layer3 ()
#2  0x002991fc in mp_decode_frame ()
#3  0x0029bcd8 in decode_frame ()
#4  0x00120cbc in avcodec_decode_audio ()
#5  0x000464a4 in decode_audio ()
#6  0x00042380 in decode_audio ()
#7  0x0000f278 in main ()
(gdb) disassemble $pc-32 $pc+32
Dump of assembler code from 0x295c10 to 0x295c50:
0x00295c10 <huffman_decode+2060>:	str	r2, [r5, #12]
0x00295c14 <huffman_decode+2064>:	str	r0, [r5, #24]
0x00295c18 <huffman_decode+2068>:	str	r2, [r5, #16]
0x00295c1c <huffman_decode+2072>:	movmi	r12, r0
0x00295c20 <huffman_decode+2076>:	movpl	r12, lr
0x00295c24 <huffman_decode+2080>:	addpl	r4, r1, lr
0x00295c28 <huffman_decode+2084>:	and	r1, r3, #7	; 0x7
0x00295c2c <huffman_decode+2088>:	str	r12, [r5, #8]
0x00295c30 <huffman_decode+2092>:	ldr	r3, [r12], #4
0x00295c34 <huffman_decode+2096>:	eor	r6, r3, r3, ror #16
0x00295c38 <huffman_decode+2100>:	bic	r6, r6, #16711680	; 0xff0000
0x00295c3c <huffman_decode+2104>:	mov	r3, r3, ror #8
0x00295c40 <huffman_decode+2108>:	eor	r3, r3, r6, lsr #8
0x00295c44 <huffman_decode+2112>:	mov	r3, r3, lsl r1
0x00295c48 <huffman_decode+2116>:	ldr	r6, [sp, #28]
0x00295c4c <huffman_decode+2120>:	movmi	lr, r0
End of assembler dump.
(gdb) info registers 
r0             0x0	0
r1             0x4	4
r2             0x0	0
r3             0xa44	2628
r4             0x64ce66	6606438
r5             0x64d2a0	6607520
r6             0x64c070	6602864
r7             0x64ce66	6606438
r8             0x0	0
r9             0x49b388	4830088
r10            0xbea71fc8	-1096343608
r11            0x402f8020	1076854816
r12            0x0	0
sp             0xbea6fe60	-1096352160
lr             0x0	0
pc             0x295c30	2710576
fps            0x1001010	16781328
cpsr           0x80000010	-2147483632

Aurel




More information about the ffmpeg-cvslog mailing list