~ubuntu-branches/ubuntu/hardy/ffmpeg/hardy

« back to all changes in this revision

Viewing changes to libavcodec/mpegaudiodec.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Dröge
  • Date: 2006-08-23 14:35:52 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060823143552-8fxnur5b9gesr03m
Tags: 3:0.cvs20060823-0ubuntu1
* Sync with Debian:
  + Add the epoch again

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
/* define USE_HIGHPRECISION to have a bit exact (but slower) mpeg
37
37
   audio decoder */
38
38
#ifdef CONFIG_MPEGAUDIO_HP
39
 
#define USE_HIGHPRECISION
 
39
#   define USE_HIGHPRECISION
40
40
#endif
41
41
 
42
42
#include "mpegaudio.h"
43
43
 
44
44
#define FRAC_ONE    (1 << FRAC_BITS)
45
45
 
46
 
#define MULL(a,b) (((int64_t)(a) * (int64_t)(b)) >> FRAC_BITS)
47
 
#define MUL64(a,b) ((int64_t)(a) * (int64_t)(b))
 
46
#ifdef ARCH_X86
 
47
#   define MULL(ra, rb) \
 
48
        ({ int rt, dummy; asm (\
 
49
            "imull %3               \n\t"\
 
50
            "shrdl %4, %%edx, %%eax \n\t"\
 
51
            : "=a"(rt), "=d"(dummy)\
 
52
            : "a" (ra), "rm" (rb), "i"(FRAC_BITS));\
 
53
         rt; })
 
54
#   define MUL64(ra, rb) \
 
55
        ({ int64_t rt; asm ("imull %2\n\t" : "=A"(rt) : "a" (ra), "g" (rb)); rt; })
 
56
#   define MULH(ra, rb) \
 
57
        ({ int rt, dummy; asm ("imull %3\n\t" : "=d"(rt), "=a"(dummy): "a" (ra), "rm" (rb)); rt; })
 
58
#elif defined(ARCH_ARMV4L)
 
59
#   define MULL(a, b) \
 
60
        ({  int lo, hi;\
 
61
            asm("smull %0, %1, %2, %3     \n\t"\
 
62
                "mov   %0, %0,     lsr #%4\n\t"\
 
63
                "add   %1, %0, %1, lsl #%5\n\t"\
 
64
            : "=r"(lo), "=r"(hi)\
 
65
            : "r"(b), "r"(a), "i"(FRAC_BITS), "i"(32-FRAC_BITS));\
 
66
         hi; })
 
67
#   define MUL64(a,b) ((int64_t)(a) * (int64_t)(b))
 
68
#   define MULH(a, b) ({ int lo, hi; asm ("smull %0, %1, %2, %3" : "=r"(lo), "=r"(hi) : "r"(b),"r"(a)); hi; })
 
69
#else
 
70
#   define MULL(a,b) (((int64_t)(a) * (int64_t)(b)) >> FRAC_BITS)
 
71
#   define MUL64(a,b) ((int64_t)(a) * (int64_t)(b))
 
72
//#define MULH(a,b) (((int64_t)(a) * (int64_t)(b))>>32) //gcc 3.4 creates an incredibly bloated mess out of this
 
73
static always_inline int MULH(int a, int b){
 
74
    return ((int64_t)(a) * (int64_t)(b))>>32;
 
75
}
 
76
#endif
48
77
#define FIX(a)   ((int)((a) * FRAC_ONE))
49
78
/* WARNING: only correct for posititive numbers */
50
79
#define FIXR(a)   ((int)((a) * FRAC_ONE + 0.5))
51
80
#define FRAC_RND(a) (((a) + (FRAC_ONE/2)) >> FRAC_BITS)
52
81
 
53
82
#define FIXHR(a) ((int)((a) * (1LL<<32) + 0.5))
54
 
//#define MULH(a,b) (((int64_t)(a) * (int64_t)(b))>>32) //gcc 3.4 creates an incredibly bloated mess out of this
55
 
static always_inline int MULH(int a, int b){
56
 
    return ((int64_t)(a) * (int64_t)(b))>>32;
57
 
}
58
83
 
59
84
/****************/
60
85
 
513
538
 
514
539
/* cos(i*pi/64) */
515
540
 
516
 
#define COS0_0  FIXR(0.50060299823519630134)
517
 
#define COS0_1  FIXR(0.50547095989754365998)
518
 
#define COS0_2  FIXR(0.51544730992262454697)
519
 
#define COS0_3  FIXR(0.53104259108978417447)
520
 
#define COS0_4  FIXR(0.55310389603444452782)
521
 
#define COS0_5  FIXR(0.58293496820613387367)
522
 
#define COS0_6  FIXR(0.62250412303566481615)
523
 
#define COS0_7  FIXR(0.67480834145500574602)
524
 
#define COS0_8  FIXR(0.74453627100229844977)
525
 
#define COS0_9  FIXR(0.83934964541552703873)
526
 
#define COS0_10 FIXR(0.97256823786196069369)
527
 
#define COS0_11 FIXR(1.16943993343288495515)
528
 
#define COS0_12 FIXR(1.48416461631416627724)
529
 
#define COS0_13 FIXR(2.05778100995341155085)
530
 
#define COS0_14 FIXR(3.40760841846871878570)
531
 
#define COS0_15 FIXR(10.19000812354805681150)
532
 
 
533
 
#define COS1_0 FIXR(0.50241928618815570551)
534
 
#define COS1_1 FIXR(0.52249861493968888062)
535
 
#define COS1_2 FIXR(0.56694403481635770368)
536
 
#define COS1_3 FIXR(0.64682178335999012954)
537
 
#define COS1_4 FIXR(0.78815462345125022473)
538
 
#define COS1_5 FIXR(1.06067768599034747134)
539
 
#define COS1_6 FIXR(1.72244709823833392782)
540
 
#define COS1_7 FIXR(5.10114861868916385802)
541
 
 
542
 
#define COS2_0 FIXR(0.50979557910415916894)
543
 
#define COS2_1 FIXR(0.60134488693504528054)
544
 
#define COS2_2 FIXR(0.89997622313641570463)
545
 
#define COS2_3 FIXR(2.56291544774150617881)
546
 
 
547
 
#define COS3_0 FIXR(0.54119610014619698439)
548
 
#define COS3_1 FIXR(1.30656296487637652785)
549
 
 
550
 
#define COS4_0 FIXR(0.70710678118654752439)
 
541
#define COS0_0  FIXHR(0.50060299823519630134/2)
 
542
#define COS0_1  FIXHR(0.50547095989754365998/2)
 
543
#define COS0_2  FIXHR(0.51544730992262454697/2)
 
544
#define COS0_3  FIXHR(0.53104259108978417447/2)
 
545
#define COS0_4  FIXHR(0.55310389603444452782/2)
 
546
#define COS0_5  FIXHR(0.58293496820613387367/2)
 
547
#define COS0_6  FIXHR(0.62250412303566481615/2)
 
548
#define COS0_7  FIXHR(0.67480834145500574602/2)
 
549
#define COS0_8  FIXHR(0.74453627100229844977/2)
 
550
#define COS0_9  FIXHR(0.83934964541552703873/2)
 
551
#define COS0_10 FIXHR(0.97256823786196069369/2)
 
552
#define COS0_11 FIXHR(1.16943993343288495515/4)
 
553
#define COS0_12 FIXHR(1.48416461631416627724/4)
 
554
#define COS0_13 FIXHR(2.05778100995341155085/8)
 
555
#define COS0_14 FIXHR(3.40760841846871878570/8)
 
556
#define COS0_15 FIXHR(10.19000812354805681150/32)
 
557
 
 
558
#define COS1_0 FIXHR(0.50241928618815570551/2)
 
559
#define COS1_1 FIXHR(0.52249861493968888062/2)
 
560
#define COS1_2 FIXHR(0.56694403481635770368/2)
 
561
#define COS1_3 FIXHR(0.64682178335999012954/2)
 
562
#define COS1_4 FIXHR(0.78815462345125022473/2)
 
563
#define COS1_5 FIXHR(1.06067768599034747134/4)
 
564
#define COS1_6 FIXHR(1.72244709823833392782/4)
 
565
#define COS1_7 FIXHR(5.10114861868916385802/16)
 
566
 
 
567
#define COS2_0 FIXHR(0.50979557910415916894/2)
 
568
#define COS2_1 FIXHR(0.60134488693504528054/2)
 
569
#define COS2_2 FIXHR(0.89997622313641570463/2)
 
570
#define COS2_3 FIXHR(2.56291544774150617881/8)
 
571
 
 
572
#define COS3_0 FIXHR(0.54119610014619698439/2)
 
573
#define COS3_1 FIXHR(1.30656296487637652785/4)
 
574
 
 
575
#define COS4_0 FIXHR(0.70710678118654752439/2)
551
576
 
552
577
/* butterfly operator */
553
 
#define BF(a, b, c)\
 
578
#define BF(a, b, c, s)\
554
579
{\
555
580
    tmp0 = tab[a] + tab[b];\
556
581
    tmp1 = tab[a] - tab[b];\
557
582
    tab[a] = tmp0;\
558
 
    tab[b] = MULL(tmp1, c);\
 
583
    tab[b] = MULH(tmp1<<(s), c);\
559
584
}
560
585
 
561
586
#define BF1(a, b, c, d)\
562
587
{\
563
 
    BF(a, b, COS4_0);\
564
 
    BF(c, d, -COS4_0);\
 
588
    BF(a, b, COS4_0, 1);\
 
589
    BF(c, d,-COS4_0, 1);\
565
590
    tab[c] += tab[d];\
566
591
}
567
592
 
568
593
#define BF2(a, b, c, d)\
569
594
{\
570
 
    BF(a, b, COS4_0);\
571
 
    BF(c, d, -COS4_0);\
 
595
    BF(a, b, COS4_0, 1);\
 
596
    BF(c, d,-COS4_0, 1);\
572
597
    tab[c] += tab[d];\
573
598
    tab[a] += tab[c];\
574
599
    tab[c] += tab[b];\
583
608
    int tmp0, tmp1;
584
609
 
585
610
    /* pass 1 */
586
 
    BF(0, 31, COS0_0);
587
 
    BF(1, 30, COS0_1);
588
 
    BF(2, 29, COS0_2);
589
 
    BF(3, 28, COS0_3);
590
 
    BF(4, 27, COS0_4);
591
 
    BF(5, 26, COS0_5);
592
 
    BF(6, 25, COS0_6);
593
 
    BF(7, 24, COS0_7);
594
 
    BF(8, 23, COS0_8);
595
 
    BF(9, 22, COS0_9);
596
 
    BF(10, 21, COS0_10);
597
 
    BF(11, 20, COS0_11);
598
 
    BF(12, 19, COS0_12);
599
 
    BF(13, 18, COS0_13);
600
 
    BF(14, 17, COS0_14);
601
 
    BF(15, 16, COS0_15);
602
 
 
603
 
    /* pass 2 */
604
 
    BF(0, 15, COS1_0);
605
 
    BF(1, 14, COS1_1);
606
 
    BF(2, 13, COS1_2);
607
 
    BF(3, 12, COS1_3);
608
 
    BF(4, 11, COS1_4);
609
 
    BF(5, 10, COS1_5);
610
 
    BF(6,  9, COS1_6);
611
 
    BF(7,  8, COS1_7);
612
 
 
613
 
    BF(16, 31, -COS1_0);
614
 
    BF(17, 30, -COS1_1);
615
 
    BF(18, 29, -COS1_2);
616
 
    BF(19, 28, -COS1_3);
617
 
    BF(20, 27, -COS1_4);
618
 
    BF(21, 26, -COS1_5);
619
 
    BF(22, 25, -COS1_6);
620
 
    BF(23, 24, -COS1_7);
621
 
 
622
 
    /* pass 3 */
623
 
    BF(0, 7, COS2_0);
624
 
    BF(1, 6, COS2_1);
625
 
    BF(2, 5, COS2_2);
626
 
    BF(3, 4, COS2_3);
627
 
 
628
 
    BF(8, 15, -COS2_0);
629
 
    BF(9, 14, -COS2_1);
630
 
    BF(10, 13, -COS2_2);
631
 
    BF(11, 12, -COS2_3);
632
 
 
633
 
    BF(16, 23, COS2_0);
634
 
    BF(17, 22, COS2_1);
635
 
    BF(18, 21, COS2_2);
636
 
    BF(19, 20, COS2_3);
637
 
 
638
 
    BF(24, 31, -COS2_0);
639
 
    BF(25, 30, -COS2_1);
640
 
    BF(26, 29, -COS2_2);
641
 
    BF(27, 28, -COS2_3);
642
 
 
643
 
    /* pass 4 */
644
 
    BF(0, 3, COS3_0);
645
 
    BF(1, 2, COS3_1);
646
 
 
647
 
    BF(4, 7, -COS3_0);
648
 
    BF(5, 6, -COS3_1);
649
 
 
650
 
    BF(8, 11, COS3_0);
651
 
    BF(9, 10, COS3_1);
652
 
 
653
 
    BF(12, 15, -COS3_0);
654
 
    BF(13, 14, -COS3_1);
655
 
 
656
 
    BF(16, 19, COS3_0);
657
 
    BF(17, 18, COS3_1);
658
 
 
659
 
    BF(20, 23, -COS3_0);
660
 
    BF(21, 22, -COS3_1);
661
 
 
662
 
    BF(24, 27, COS3_0);
663
 
    BF(25, 26, COS3_1);
664
 
 
665
 
    BF(28, 31, -COS3_0);
666
 
    BF(29, 30, -COS3_1);
 
611
    BF( 0, 31, COS0_0 , 1);
 
612
    BF(15, 16, COS0_15, 5);
 
613
    /* pass 2 */
 
614
    BF( 0, 15, COS1_0 , 1);
 
615
    BF(16, 31,-COS1_0 , 1);
 
616
    /* pass 1 */
 
617
    BF( 7, 24, COS0_7 , 1);
 
618
    BF( 8, 23, COS0_8 , 1);
 
619
    /* pass 2 */
 
620
    BF( 7,  8, COS1_7 , 4);
 
621
    BF(23, 24,-COS1_7 , 4);
 
622
    /* pass 3 */
 
623
    BF( 0,  7, COS2_0 , 1);
 
624
    BF( 8, 15,-COS2_0 , 1);
 
625
    BF(16, 23, COS2_0 , 1);
 
626
    BF(24, 31,-COS2_0 , 1);
 
627
    /* pass 1 */
 
628
    BF( 3, 28, COS0_3 , 1);
 
629
    BF(12, 19, COS0_12, 2);
 
630
    /* pass 2 */
 
631
    BF( 3, 12, COS1_3 , 1);
 
632
    BF(19, 28,-COS1_3 , 1);
 
633
    /* pass 1 */
 
634
    BF( 4, 27, COS0_4 , 1);
 
635
    BF(11, 20, COS0_11, 2);
 
636
    /* pass 2 */
 
637
    BF( 4, 11, COS1_4 , 1);
 
638
    BF(20, 27,-COS1_4 , 1);
 
639
    /* pass 3 */
 
640
    BF( 3,  4, COS2_3 , 3);
 
641
    BF(11, 12,-COS2_3 , 3);
 
642
    BF(19, 20, COS2_3 , 3);
 
643
    BF(27, 28,-COS2_3 , 3);
 
644
    /* pass 4 */
 
645
    BF( 0,  3, COS3_0 , 1);
 
646
    BF( 4,  7,-COS3_0 , 1);
 
647
    BF( 8, 11, COS3_0 , 1);
 
648
    BF(12, 15,-COS3_0 , 1);
 
649
    BF(16, 19, COS3_0 , 1);
 
650
    BF(20, 23,-COS3_0 , 1);
 
651
    BF(24, 27, COS3_0 , 1);
 
652
    BF(28, 31,-COS3_0 , 1);
 
653
 
 
654
 
 
655
 
 
656
    /* pass 1 */
 
657
    BF( 1, 30, COS0_1 , 1);
 
658
    BF(14, 17, COS0_14, 3);
 
659
    /* pass 2 */
 
660
    BF( 1, 14, COS1_1 , 1);
 
661
    BF(17, 30,-COS1_1 , 1);
 
662
    /* pass 1 */
 
663
    BF( 6, 25, COS0_6 , 1);
 
664
    BF( 9, 22, COS0_9 , 1);
 
665
    /* pass 2 */
 
666
    BF( 6,  9, COS1_6 , 2);
 
667
    BF(22, 25,-COS1_6 , 2);
 
668
    /* pass 3 */
 
669
    BF( 1,  6, COS2_1 , 1);
 
670
    BF( 9, 14,-COS2_1 , 1);
 
671
    BF(17, 22, COS2_1 , 1);
 
672
    BF(25, 30,-COS2_1 , 1);
 
673
 
 
674
    /* pass 1 */
 
675
    BF( 2, 29, COS0_2 , 1);
 
676
    BF(13, 18, COS0_13, 3);
 
677
    /* pass 2 */
 
678
    BF( 2, 13, COS1_2 , 1);
 
679
    BF(18, 29,-COS1_2 , 1);
 
680
    /* pass 1 */
 
681
    BF( 5, 26, COS0_5 , 1);
 
682
    BF(10, 21, COS0_10, 1);
 
683
    /* pass 2 */
 
684
    BF( 5, 10, COS1_5 , 2);
 
685
    BF(21, 26,-COS1_5 , 2);
 
686
    /* pass 3 */
 
687
    BF( 2,  5, COS2_2 , 1);
 
688
    BF(10, 13,-COS2_2 , 1);
 
689
    BF(18, 21, COS2_2 , 1);
 
690
    BF(26, 29,-COS2_2 , 1);
 
691
    /* pass 4 */
 
692
    BF( 1,  2, COS3_1 , 2);
 
693
    BF( 5,  6,-COS3_1 , 2);
 
694
    BF( 9, 10, COS3_1 , 2);
 
695
    BF(13, 14,-COS3_1 , 2);
 
696
    BF(17, 18, COS3_1 , 2);
 
697
    BF(21, 22,-COS3_1 , 2);
 
698
    BF(25, 26, COS3_1 , 2);
 
699
    BF(29, 30,-COS3_1 , 2);
667
700
 
668
701
    /* pass 5 */
669
 
    BF1(0, 1, 2, 3);
670
 
    BF2(4, 5, 6, 7);
671
 
    BF1(8, 9, 10, 11);
 
702
    BF1( 0,  1,  2,  3);
 
703
    BF2( 4,  5,  6,  7);
 
704
    BF1( 8,  9, 10, 11);
672
705
    BF2(12, 13, 14, 15);
673
706
    BF1(16, 17, 18, 19);
674
707
    BF2(20, 21, 22, 23);
742
775
    return sum1;
743
776
}
744
777
 
745
 
#if defined(ARCH_POWERPC_405)
746
 
 
747
 
/* signed 16x16 -> 32 multiply add accumulate */
748
 
#define MACS(rt, ra, rb) \
749
 
    asm ("maclhw %0, %2, %3" : "=r" (rt) : "0" (rt), "r" (ra), "r" (rb));
750
 
 
751
 
/* signed 16x16 -> 32 multiply */
752
 
#define MULS(ra, rb) \
753
 
    ({ int __rt; asm ("mullhw %0, %1, %2" : "=r" (__rt) : "r" (ra), "r" (rb)); __rt; })
754
 
 
755
 
#else
756
 
 
757
 
/* signed 16x16 -> 32 multiply add accumulate */
758
 
#define MACS(rt, ra, rb) rt += (ra) * (rb)
759
 
 
760
 
/* signed 16x16 -> 32 multiply */
761
 
#define MULS(ra, rb) ((ra) * (rb))
762
 
 
763
 
#endif
764
 
 
 
778
#   if defined(ARCH_POWERPC_405)
 
779
        /* signed 16x16 -> 32 multiply add accumulate */
 
780
#       define MACS(rt, ra, rb) \
 
781
            asm ("maclhw %0, %2, %3" : "=r" (rt) : "0" (rt), "r" (ra), "r" (rb));
 
782
 
 
783
        /* signed 16x16 -> 32 multiply */
 
784
#       define MULS(ra, rb) \
 
785
            ({ int __rt; asm ("mullhw %0, %1, %2" : "=r" (__rt) : "r" (ra), "r" (rb)); __rt; })
 
786
#   else
 
787
        /* signed 16x16 -> 32 multiply add accumulate */
 
788
#       define MACS(rt, ra, rb) rt += (ra) * (rb)
 
789
 
 
790
        /* signed 16x16 -> 32 multiply */
 
791
#       define MULS(ra, rb) ((ra) * (rb))
 
792
#   endif
765
793
#else
766
794
 
767
795
static inline int round_sample(int64_t *sum)
776
804
    return sum1;
777
805
}
778
806
 
779
 
#define MULS(ra, rb) MUL64(ra, rb)
780
 
 
 
807
#   define MULS(ra, rb) MUL64(ra, rb)
781
808
#endif
782
809
 
783
810
#define SUM8(sum, op, w, p) \
934
961
    FIXR(5.73685662283492756461),
935
962
};
936
963
 
 
964
/* 0.5 / cos(pi*(2*i+1)/36) */
 
965
static const int icos36h[9] = {
 
966
    FIXHR(0.50190991877167369479/2),
 
967
    FIXHR(0.51763809020504152469/2), //0
 
968
    FIXHR(0.55168895948124587824/2),
 
969
    FIXHR(0.61038729438072803416/2),
 
970
    FIXHR(0.70710678118654752439/2), //1
 
971
    FIXHR(0.87172339781054900991/2),
 
972
    FIXHR(1.18310079157624925896/4),
 
973
    FIXHR(1.93185165257813657349/4), //2
 
974
//    FIXHR(5.73685662283492756461),
 
975
};
 
976
 
937
977
/* 12 points IMDCT. We compute it "by hand" by factorizing obvious
938
978
   cases. */
939
979
static void imdct12(int *out, int *in)
950
990
    in3 += in1;
951
991
 
952
992
    in2= MULH(2*in2, C3);
953
 
    in3= MULH(2*in3, C3);
 
993
    in3= MULH(4*in3, C3);
954
994
 
955
995
    t1 = in0 - in4;
956
 
    t2 = MULL(in1 - in5, icos36[4]);
 
996
    t2 = MULH(2*(in1 - in5), icos36h[4]);
957
997
 
958
998
    out[ 7]=
959
999
    out[10]= t1 + t2;
962
1002
 
963
1003
    in0 += in4>>1;
964
1004
    in4 = in0 + in2;
965
 
    in1 += in5>>1;
966
 
    in5 = MULL(in1 + in3, icos36[1]);
 
1005
    in5 += 2*in1;
 
1006
    in1 = MULH(in5 + in3, icos36h[1]);
967
1007
    out[ 8]=
968
 
    out[ 9]= in4 + in5;
 
1008
    out[ 9]= in4 + in1;
969
1009
    out[ 2]=
970
 
    out[ 3]= in4 - in5;
 
1010
    out[ 3]= in4 - in1;
971
1011
 
972
1012
    in0 -= in2;
973
 
    in1 = MULL(in1 - in3, icos36[7]);
 
1013
    in5 = MULH(2*(in5 - in3), icos36h[7]);
974
1014
    out[ 0]=
975
 
    out[ 5]= in0 - in1;
 
1015
    out[ 5]= in0 - in5;
976
1016
    out[ 6]=
977
 
    out[11]= in0 + in1;
 
1017
    out[11]= in0 + in5;
978
1018
}
979
1019
 
980
1020
/* cos(pi*i/18) */
1068
1108
 
1069
1109
        t2 = tmp[i + 1];
1070
1110
        t3 = tmp[i + 3];
1071
 
        s1 = MULL(t3 + t2, icos36[j]);
 
1111
        s1 = MULH(2*(t3 + t2), icos36h[j]);
1072
1112
        s3 = MULL(t3 - t2, icos36[8 - j]);
1073
1113
 
1074
1114
        t0 = s0 + s1;
1088
1128
    }
1089
1129
 
1090
1130
    s0 = tmp[16];
1091
 
    s1 = MULL(tmp[17], icos36[4]);
 
1131
    s1 = MULH(2*tmp[17], icos36h[4]);
1092
1132
    t0 = s0 + s1;
1093
1133
    t1 = s0 - s1;
1094
1134
    out[(9 + 4)*SBLIMIT] =  MULH(t1, win[9 + 4]) + buf[9 + 4];
1650
1690
            if (get_bits_count(&s->gb) >= end_pos)
1651
1691
                break;
1652
1692
            if (code_table) {
1653
 
                code = get_vlc2(&s->gb, vlc->table, 8, 2);
 
1693
                code = get_vlc2(&s->gb, vlc->table, 8, 3);
1654
1694
                if (code < 0)
1655
1695
                    return -1;
1656
1696
                y = code_table[code];