Search
lxdream.org :: lxdream :: r644:ccae4bfa5f82
lxdream 0.9.1
released Jun 29
Download Now
changeset644:ccae4bfa5f82
parent643:653b0a70f173
child653:3202ff01d48e
authornkeynes
dateSun Mar 02 11:38:08 2008 +0000 (11 years ago)
Bug #59: Add provisional support for all CD read modes (not validated)
src/Makefile.am
src/Makefile.in
src/drivers/cd_linux.c
src/gdrom/README.LIBEDC
src/gdrom/cdi.c
src/gdrom/ecc.h
src/gdrom/edc_crctable.h
src/gdrom/edc_ecc.c
src/gdrom/edc_encoder.h
src/gdrom/edc_l2sq.h
src/gdrom/edc_scramble.h
src/gdrom/gdi.c
src/gdrom/gdimage.c
src/gdrom/gdrom.c
src/gdrom/gdrom.h
src/gdrom/nrg.c
src/gdrom/packet.h
1.1 --- a/src/Makefile.am Tue Feb 26 01:10:48 2008 +0000
1.2 +++ b/src/Makefile.am Sun Mar 02 11:38:08 2008 +0000
1.3 @@ -25,6 +25,8 @@
1.4 syscall.c syscall.h bios.c dcload.c \
1.5 gdrom/ide.c gdrom/ide.h gdrom/packet.h gdrom/gdimage.c \
1.6 gdrom/gdrom.c gdrom/gdrom.h gdrom/nrg.c gdrom/cdi.c gdrom/gdi.c \
1.7 + gdrom/edc_ecc.c gdrom/ecc.h gdrom/edc_crctable.h gdrom/edc_encoder.h \
1.8 + gdrom/edc_l2sq.h gdrom/scramble.h \
1.9 dreamcast.c dreamcast.h eventq.c eventq.h \
1.10 sh4/sh4.c sh4/intc.c sh4/intc.h sh4/sh4mem.c sh4/timer.c sh4/dmac.c \
1.11 sh4/mmu.c sh4/sh4core.c sh4/sh4core.h sh4/sh4dasm.c sh4/sh4dasm.h \
2.1 --- a/src/Makefile.in Tue Feb 26 01:10:48 2008 +0000
2.2 +++ b/src/Makefile.in Sun Mar 02 11:38:08 2008 +0000
2.3 @@ -222,6 +222,8 @@
2.4 syscall.c syscall.h bios.c dcload.c \
2.5 gdrom/ide.c gdrom/ide.h gdrom/packet.h gdrom/gdimage.c \
2.6 gdrom/gdrom.c gdrom/gdrom.h gdrom/nrg.c gdrom/cdi.c gdrom/gdi.c \
2.7 + gdrom/edc_ecc.c gdrom/ecc.h gdrom/edc_crctable.h gdrom/edc_encoder.h \
2.8 + gdrom/edc_l2sq.h gdrom/scramble.h \
2.9 dreamcast.c dreamcast.h eventq.c eventq.h \
2.10 sh4/sh4.c sh4/intc.c sh4/intc.h sh4/sh4mem.c sh4/timer.c sh4/dmac.c \
2.11 sh4/mmu.c sh4/sh4core.c sh4/sh4core.h sh4/sh4dasm.c sh4/sh4dasm.h \
2.12 @@ -280,6 +282,8 @@
2.13 watch.c asic.c asic.h syscall.c syscall.h bios.c dcload.c \
2.14 gdrom/ide.c gdrom/ide.h gdrom/packet.h gdrom/gdimage.c \
2.15 gdrom/gdrom.c gdrom/gdrom.h gdrom/nrg.c gdrom/cdi.c gdrom/gdi.c \
2.16 + gdrom/edc_ecc.c gdrom/ecc.h gdrom/edc_crctable.h \
2.17 + gdrom/edc_encoder.h gdrom/edc_l2sq.h gdrom/scramble.h \
2.18 dreamcast.c dreamcast.h eventq.c eventq.h sh4/sh4.c sh4/intc.c \
2.19 sh4/intc.h sh4/sh4mem.c sh4/timer.c sh4/dmac.c sh4/mmu.c \
2.20 sh4/sh4core.c sh4/sh4core.h sh4/sh4dasm.c sh4/sh4dasm.h \
2.21 @@ -322,22 +326,23 @@
2.22 watch.$(OBJEXT) asic.$(OBJEXT) syscall.$(OBJEXT) bios.$(OBJEXT) \
2.23 dcload.$(OBJEXT) ide.$(OBJEXT) gdimage.$(OBJEXT) \
2.24 gdrom.$(OBJEXT) nrg.$(OBJEXT) cdi.$(OBJEXT) gdi.$(OBJEXT) \
2.25 - dreamcast.$(OBJEXT) eventq.$(OBJEXT) sh4.$(OBJEXT) \
2.26 - intc.$(OBJEXT) sh4mem.$(OBJEXT) timer.$(OBJEXT) dmac.$(OBJEXT) \
2.27 - mmu.$(OBJEXT) sh4core.$(OBJEXT) sh4dasm.$(OBJEXT) \
2.28 - sh4mmio.$(OBJEXT) scif.$(OBJEXT) sh4stat.$(OBJEXT) \
2.29 - xltcache.$(OBJEXT) armcore.$(OBJEXT) armdasm.$(OBJEXT) \
2.30 - armmem.$(OBJEXT) aica.$(OBJEXT) audio.$(OBJEXT) pvr2.$(OBJEXT) \
2.31 - pvr2mem.$(OBJEXT) tacore.$(OBJEXT) render.$(OBJEXT) \
2.32 - rendcore.$(OBJEXT) rendbkg.$(OBJEXT) rendsort.$(OBJEXT) \
2.33 - texcache.$(OBJEXT) yuv.$(OBJEXT) rendsave.$(OBJEXT) \
2.34 - maple.$(OBJEXT) controller.$(OBJEXT) kbd.$(OBJEXT) \
2.35 - mouse.$(OBJEXT) loader.$(OBJEXT) bootstrap.$(OBJEXT) \
2.36 - util.$(OBJEXT) display.$(OBJEXT) audio_null.$(OBJEXT) \
2.37 - video_null.$(OBJEXT) gl_common.$(OBJEXT) gl_fbo.$(OBJEXT) \
2.38 - gl_sl.$(OBJEXT) gl_slsrc.$(OBJEXT) $(am__objects_1) \
2.39 - $(am__objects_2) $(am__objects_3) $(am__objects_4) \
2.40 - $(am__objects_5) $(am__objects_6) $(am__objects_7)
2.41 + edc_ecc.$(OBJEXT) dreamcast.$(OBJEXT) eventq.$(OBJEXT) \
2.42 + sh4.$(OBJEXT) intc.$(OBJEXT) sh4mem.$(OBJEXT) timer.$(OBJEXT) \
2.43 + dmac.$(OBJEXT) mmu.$(OBJEXT) sh4core.$(OBJEXT) \
2.44 + sh4dasm.$(OBJEXT) sh4mmio.$(OBJEXT) scif.$(OBJEXT) \
2.45 + sh4stat.$(OBJEXT) xltcache.$(OBJEXT) armcore.$(OBJEXT) \
2.46 + armdasm.$(OBJEXT) armmem.$(OBJEXT) aica.$(OBJEXT) \
2.47 + audio.$(OBJEXT) pvr2.$(OBJEXT) pvr2mem.$(OBJEXT) \
2.48 + tacore.$(OBJEXT) render.$(OBJEXT) rendcore.$(OBJEXT) \
2.49 + rendbkg.$(OBJEXT) rendsort.$(OBJEXT) texcache.$(OBJEXT) \
2.50 + yuv.$(OBJEXT) rendsave.$(OBJEXT) maple.$(OBJEXT) \
2.51 + controller.$(OBJEXT) kbd.$(OBJEXT) mouse.$(OBJEXT) \
2.52 + loader.$(OBJEXT) bootstrap.$(OBJEXT) util.$(OBJEXT) \
2.53 + display.$(OBJEXT) audio_null.$(OBJEXT) video_null.$(OBJEXT) \
2.54 + gl_common.$(OBJEXT) gl_fbo.$(OBJEXT) gl_sl.$(OBJEXT) \
2.55 + gl_slsrc.$(OBJEXT) $(am__objects_1) $(am__objects_2) \
2.56 + $(am__objects_3) $(am__objects_4) $(am__objects_5) \
2.57 + $(am__objects_6) $(am__objects_7)
2.58 lxdream_OBJECTS = $(am_lxdream_OBJECTS)
2.59 lxdream_DEPENDENCIES =
2.60 lxdream_LDFLAGS =
2.61 @@ -378,36 +383,36 @@
2.62 @AMDEP_TRUE@ ./$(DEPDIR)/dis-buf.Po ./$(DEPDIR)/dis-init.Po \
2.63 @AMDEP_TRUE@ ./$(DEPDIR)/display.Po ./$(DEPDIR)/dmac.Po \
2.64 @AMDEP_TRUE@ ./$(DEPDIR)/dreamcast.Po ./$(DEPDIR)/dump_win.Po \
2.65 -@AMDEP_TRUE@ ./$(DEPDIR)/eventq.Po ./$(DEPDIR)/gdi.Po \
2.66 -@AMDEP_TRUE@ ./$(DEPDIR)/gdimage.Po ./$(DEPDIR)/gdrom.Po \
2.67 -@AMDEP_TRUE@ ./$(DEPDIR)/gdrom_menu.Po ./$(DEPDIR)/gendec.Po \
2.68 -@AMDEP_TRUE@ ./$(DEPDIR)/genglsl.Po ./$(DEPDIR)/gl_common.Po \
2.69 -@AMDEP_TRUE@ ./$(DEPDIR)/gl_fbo.Po ./$(DEPDIR)/gl_sl.Po \
2.70 -@AMDEP_TRUE@ ./$(DEPDIR)/gl_slsrc.Po ./$(DEPDIR)/gtkcb.Po \
2.71 -@AMDEP_TRUE@ ./$(DEPDIR)/gtkui.Po ./$(DEPDIR)/i386-dis.Po \
2.72 -@AMDEP_TRUE@ ./$(DEPDIR)/ide.Po ./$(DEPDIR)/insparse.Po \
2.73 -@AMDEP_TRUE@ ./$(DEPDIR)/intc.Po ./$(DEPDIR)/joy_linux.Po \
2.74 -@AMDEP_TRUE@ ./$(DEPDIR)/kbd.Po ./$(DEPDIR)/loader.Po \
2.75 -@AMDEP_TRUE@ ./$(DEPDIR)/main.Po ./$(DEPDIR)/main_win.Po \
2.76 -@AMDEP_TRUE@ ./$(DEPDIR)/maple.Po ./$(DEPDIR)/mem.Po \
2.77 -@AMDEP_TRUE@ ./$(DEPDIR)/mmio_win.Po ./$(DEPDIR)/mmu.Po \
2.78 -@AMDEP_TRUE@ ./$(DEPDIR)/mouse.Po ./$(DEPDIR)/nrg.Po \
2.79 -@AMDEP_TRUE@ ./$(DEPDIR)/path_dlg.Po ./$(DEPDIR)/pvr2.Po \
2.80 -@AMDEP_TRUE@ ./$(DEPDIR)/pvr2mem.Po ./$(DEPDIR)/rendbkg.Po \
2.81 -@AMDEP_TRUE@ ./$(DEPDIR)/rendcore.Po ./$(DEPDIR)/render.Po \
2.82 -@AMDEP_TRUE@ ./$(DEPDIR)/rendsave.Po ./$(DEPDIR)/rendsort.Po \
2.83 -@AMDEP_TRUE@ ./$(DEPDIR)/scif.Po ./$(DEPDIR)/sh4.Po \
2.84 -@AMDEP_TRUE@ ./$(DEPDIR)/sh4core.Po ./$(DEPDIR)/sh4dasm.Po \
2.85 -@AMDEP_TRUE@ ./$(DEPDIR)/sh4mem.Po ./$(DEPDIR)/sh4mmio.Po \
2.86 -@AMDEP_TRUE@ ./$(DEPDIR)/sh4stat.Po ./$(DEPDIR)/sh4trans.Po \
2.87 -@AMDEP_TRUE@ ./$(DEPDIR)/sh4x86.Po ./$(DEPDIR)/syscall.Po \
2.88 -@AMDEP_TRUE@ ./$(DEPDIR)/tacore.Po ./$(DEPDIR)/testsh4x86.Po \
2.89 -@AMDEP_TRUE@ ./$(DEPDIR)/testxlt.Po ./$(DEPDIR)/texcache.Po \
2.90 -@AMDEP_TRUE@ ./$(DEPDIR)/timer.Po ./$(DEPDIR)/util.Po \
2.91 -@AMDEP_TRUE@ ./$(DEPDIR)/video_glx.Po ./$(DEPDIR)/video_gtk.Po \
2.92 -@AMDEP_TRUE@ ./$(DEPDIR)/video_null.Po ./$(DEPDIR)/watch.Po \
2.93 -@AMDEP_TRUE@ ./$(DEPDIR)/x86dasm.Po ./$(DEPDIR)/xltcache.Po \
2.94 -@AMDEP_TRUE@ ./$(DEPDIR)/yuv.Po
2.95 +@AMDEP_TRUE@ ./$(DEPDIR)/edc_ecc.Po ./$(DEPDIR)/eventq.Po \
2.96 +@AMDEP_TRUE@ ./$(DEPDIR)/gdi.Po ./$(DEPDIR)/gdimage.Po \
2.97 +@AMDEP_TRUE@ ./$(DEPDIR)/gdrom.Po ./$(DEPDIR)/gdrom_menu.Po \
2.98 +@AMDEP_TRUE@ ./$(DEPDIR)/gendec.Po ./$(DEPDIR)/genglsl.Po \
2.99 +@AMDEP_TRUE@ ./$(DEPDIR)/gl_common.Po ./$(DEPDIR)/gl_fbo.Po \
2.100 +@AMDEP_TRUE@ ./$(DEPDIR)/gl_sl.Po ./$(DEPDIR)/gl_slsrc.Po \
2.101 +@AMDEP_TRUE@ ./$(DEPDIR)/gtkcb.Po ./$(DEPDIR)/gtkui.Po \
2.102 +@AMDEP_TRUE@ ./$(DEPDIR)/i386-dis.Po ./$(DEPDIR)/ide.Po \
2.103 +@AMDEP_TRUE@ ./$(DEPDIR)/insparse.Po ./$(DEPDIR)/intc.Po \
2.104 +@AMDEP_TRUE@ ./$(DEPDIR)/joy_linux.Po ./$(DEPDIR)/kbd.Po \
2.105 +@AMDEP_TRUE@ ./$(DEPDIR)/loader.Po ./$(DEPDIR)/main.Po \
2.106 +@AMDEP_TRUE@ ./$(DEPDIR)/main_win.Po ./$(DEPDIR)/maple.Po \
2.107 +@AMDEP_TRUE@ ./$(DEPDIR)/mem.Po ./$(DEPDIR)/mmio_win.Po \
2.108 +@AMDEP_TRUE@ ./$(DEPDIR)/mmu.Po ./$(DEPDIR)/mouse.Po \
2.109 +@AMDEP_TRUE@ ./$(DEPDIR)/nrg.Po ./$(DEPDIR)/path_dlg.Po \
2.110 +@AMDEP_TRUE@ ./$(DEPDIR)/pvr2.Po ./$(DEPDIR)/pvr2mem.Po \
2.111 +@AMDEP_TRUE@ ./$(DEPDIR)/rendbkg.Po ./$(DEPDIR)/rendcore.Po \
2.112 +@AMDEP_TRUE@ ./$(DEPDIR)/render.Po ./$(DEPDIR)/rendsave.Po \
2.113 +@AMDEP_TRUE@ ./$(DEPDIR)/rendsort.Po ./$(DEPDIR)/scif.Po \
2.114 +@AMDEP_TRUE@ ./$(DEPDIR)/sh4.Po ./$(DEPDIR)/sh4core.Po \
2.115 +@AMDEP_TRUE@ ./$(DEPDIR)/sh4dasm.Po ./$(DEPDIR)/sh4mem.Po \
2.116 +@AMDEP_TRUE@ ./$(DEPDIR)/sh4mmio.Po ./$(DEPDIR)/sh4stat.Po \
2.117 +@AMDEP_TRUE@ ./$(DEPDIR)/sh4trans.Po ./$(DEPDIR)/sh4x86.Po \
2.118 +@AMDEP_TRUE@ ./$(DEPDIR)/syscall.Po ./$(DEPDIR)/tacore.Po \
2.119 +@AMDEP_TRUE@ ./$(DEPDIR)/testsh4x86.Po ./$(DEPDIR)/testxlt.Po \
2.120 +@AMDEP_TRUE@ ./$(DEPDIR)/texcache.Po ./$(DEPDIR)/timer.Po \
2.121 +@AMDEP_TRUE@ ./$(DEPDIR)/util.Po ./$(DEPDIR)/video_glx.Po \
2.122 +@AMDEP_TRUE@ ./$(DEPDIR)/video_gtk.Po ./$(DEPDIR)/video_null.Po \
2.123 +@AMDEP_TRUE@ ./$(DEPDIR)/watch.Po ./$(DEPDIR)/x86dasm.Po \
2.124 +@AMDEP_TRUE@ ./$(DEPDIR)/xltcache.Po ./$(DEPDIR)/yuv.Po
2.125 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
2.126 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
2.127 CCLD = $(CC)
2.128 @@ -509,6 +514,7 @@
2.129 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmac.Po@am__quote@
2.130 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dreamcast.Po@am__quote@
2.131 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dump_win.Po@am__quote@
2.132 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edc_ecc.Po@am__quote@
2.133 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eventq.Po@am__quote@
2.134 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gdi.Po@am__quote@
2.135 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gdimage.Po@am__quote@
2.136 @@ -811,6 +817,28 @@
2.137 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.138 @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gdi.obj `if test -f 'gdrom/gdi.c'; then $(CYGPATH_W) 'gdrom/gdi.c'; else $(CYGPATH_W) '$(srcdir)/gdrom/gdi.c'; fi`
2.139
2.140 +edc_ecc.o: gdrom/edc_ecc.c
2.141 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edc_ecc.o -MD -MP -MF "$(DEPDIR)/edc_ecc.Tpo" \
2.142 +@am__fastdepCC_TRUE@ -c -o edc_ecc.o `test -f 'gdrom/edc_ecc.c' || echo '$(srcdir)/'`gdrom/edc_ecc.c; \
2.143 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/edc_ecc.Tpo" "$(DEPDIR)/edc_ecc.Po"; \
2.144 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/edc_ecc.Tpo"; exit 1; \
2.145 +@am__fastdepCC_TRUE@ fi
2.146 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gdrom/edc_ecc.c' object='edc_ecc.o' libtool=no @AMDEPBACKSLASH@
2.147 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/edc_ecc.Po' tmpdepfile='$(DEPDIR)/edc_ecc.TPo' @AMDEPBACKSLASH@
2.148 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.149 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edc_ecc.o `test -f 'gdrom/edc_ecc.c' || echo '$(srcdir)/'`gdrom/edc_ecc.c
2.150 +
2.151 +edc_ecc.obj: gdrom/edc_ecc.c
2.152 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edc_ecc.obj -MD -MP -MF "$(DEPDIR)/edc_ecc.Tpo" \
2.153 +@am__fastdepCC_TRUE@ -c -o edc_ecc.obj `if test -f 'gdrom/edc_ecc.c'; then $(CYGPATH_W) 'gdrom/edc_ecc.c'; else $(CYGPATH_W) '$(srcdir)/gdrom/edc_ecc.c'; fi`; \
2.154 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/edc_ecc.Tpo" "$(DEPDIR)/edc_ecc.Po"; \
2.155 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/edc_ecc.Tpo"; exit 1; \
2.156 +@am__fastdepCC_TRUE@ fi
2.157 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gdrom/edc_ecc.c' object='edc_ecc.obj' libtool=no @AMDEPBACKSLASH@
2.158 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/edc_ecc.Po' tmpdepfile='$(DEPDIR)/edc_ecc.TPo' @AMDEPBACKSLASH@
2.159 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.160 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edc_ecc.obj `if test -f 'gdrom/edc_ecc.c'; then $(CYGPATH_W) 'gdrom/edc_ecc.c'; else $(CYGPATH_W) '$(srcdir)/gdrom/edc_ecc.c'; fi`
2.161 +
2.162 sh4.o: sh4/sh4.c
2.163 @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sh4.o -MD -MP -MF "$(DEPDIR)/sh4.Tpo" \
2.164 @am__fastdepCC_TRUE@ -c -o sh4.o `test -f 'sh4/sh4.c' || echo '$(srcdir)/'`sh4/sh4.c; \
3.1 --- a/src/drivers/cd_linux.c Tue Feb 26 01:10:48 2008 +0000
3.2 +++ b/src/drivers/cd_linux.c Sun Mar 02 11:38:08 2008 +0000
3.3 @@ -127,7 +127,6 @@
3.4 }
3.5 disc->read_sector = linux_read_sector;
3.6 disc->drive_status = linux_drive_status;
3.7 - ((gdrom_image_t)disc)->disc_type = IDE_DISC_CDROM;
3.8 return disc;
3.9 }
3.10
3.11 @@ -167,7 +166,7 @@
3.12 int last_track = -1;
3.13 int leadout = -1;
3.14 int len = (buf[0] << 8) | buf[1];
3.15 - int session_type = GDROM_MODE1;
3.16 + int session_type = -1;
3.17 int i;
3.18 for( i = 4; i<len; i+=11 ) {
3.19 int session = buf[i];
3.20 @@ -195,10 +194,12 @@
3.21 } else switch( (adr << 8) | point ) {
3.22 case 0x1A0: /* session info */
3.23 if( buf[i+9] == 0x20 ) {
3.24 - session_type = GDROM_MODE2;
3.25 + session_type = IDE_DISC_CDROMXA;
3.26 } else {
3.27 - session_type = GDROM_MODE1;
3.28 + session_type = IDE_DISC_CDROM;
3.29 }
3.30 + disc->disc_type = session_type;
3.31 + break;
3.32 case 0x1A2: /* leadout */
3.33 leadout = MSFTOLBA(buf[i+8], buf[i+9], buf[i+10]);
3.34 break;
3.35 @@ -256,7 +257,20 @@
3.36 cmd[6] = 0;
3.37 cmd[7] = 0;
3.38 cmd[8] = 1;
3.39 - cmd[9] = 0x10;
3.40 +
3.41 + if( READ_CD_RAW(mode) ) {
3.42 + cmd[9] = 0xF0;
3.43 + } else {
3.44 + if( READ_CD_HEADER(mode) ) {
3.45 + cmd[9] = 0xA0;
3.46 + }
3.47 + if( READ_CD_SUBHEAD(mode) ) {
3.48 + cmd[9] |= 0x40;
3.49 + }
3.50 + if( READ_CD_DATA(mode) ) {
3.51 + cmd[9] |= 0x10;
3.52 + }
3.53 + }
3.54
3.55 gdrom_error_t status = linux_send_command( fd, cmd, buf, &sector_size, CGC_DATA_READ );
3.56 if( status != 0 ) {
3.57 @@ -285,7 +299,7 @@
3.58 cgc.sense = &sense;
3.59 cgc.data_direction = direction;
3.60
3.61 - if( ioctl(fd, CDROM_SEND_PACKET, &cgc) == -1 ) {
3.62 + if( ioctl(fd, CDROM_SEND_PACKET, &cgc) < 0 ) {
3.63 if( sense.sense_key == 0 ) {
3.64 return -1;
3.65 } else {
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/src/gdrom/README.LIBEDC Sun Mar 02 11:38:08 2008 +0000
4.3 @@ -0,0 +1,123 @@
4.4 +This describes the program as shipped with cdrkit, a spinoff from the
4.5 +cdrtools project. However, the cdrtools developers are no longer
4.6 +involved in the development of this spinoff and therefore shall not
4.7 +be made responsible for any problem caused by it. Do not try to get
4.8 +support for this program by contacting the original authors.
4.9 +
4.10 +This is a small description for the Reed-Solomon library intended for
4.11 +CD sector formatting.
4.12 +
4.13 +Basics:
4.14 +It is assumed that you have a basic knowledge of cd sector formats.
4.15 +
4.16 +The library can handle three types of sector data:
4.17 + data sectors,
4.18 + audio sectors, and
4.19 + sub channel r-w sectors
4.20 +
4.21 +Currently only encoding is implemented. Decoding and optionally
4.22 +error correction is planned for later.
4.23 +
4.24 +Stages:
4.25 +
4.26 +The process of sector formatting has several stages. Beginning with
4.27 +a data sector (2048, 2324, or 2336 bytes) a sector of 2352 bytes is
4.28 +built. This format can be read raw by SCSI MMC-2 and ATAPI drives and
4.29 +is accepted by cd burners. The additions are an optionally 32 bit CRC
4.30 +checksum and two layers of Reed-Solomon codes (called Reed-Solomon
4.31 +Product Code RSPC).
4.32 +This sector is then scrambled (exor'ed with a bitstream).
4.33 +The result is called F1 frames. Afterwards even and odd bytes are
4.34 +swapped, this is called F2 frames. The result is equivalent to an
4.35 +audio sector and is treated as such by the cd burner.
4.36 +So, if we wrote a series of sectors (F2 frames) into a CDR file and
4.37 +later burned them as 'audio', they would turn up as perfect data sectors.
4.38 +
4.39 +So, now we are at the level of audio sectors. Audio sectors get their
4.40 +own error correction data (called CIRC). Sector size goes up to
4.41 +3136 bytes (that is 4/3 times 2352 bytes). Furthermore different
4.42 +words get delayed differently and swap positions. The result is ready
4.43 +to be fed into the so-called EightFourteenModulator (when subchannels
4.44 +have been added).
4.45 +
4.46 +Now, only sub channels are missing. While the p and q sub
4.47 +channels have to be generated elsewhere, any supplied r-w subchannel
4.48 +user data is protected by two levels of error correction
4.49 +codes. This format is read by cd burners when burning cd+graphics.
4.50 +The cdimage is a sequence of sectors, each containing audio data and
4.51 +after that subchannel data.
4.52 +Similar to audio sectors delaying and permutation of words
4.53 +takes place. After that the cd burner would mix sub channel data with
4.54 +the formatted audio sectors to feed the EFModulator.
4.55 +
4.56 +NOTE: Most of the described stages need not to be done in order to
4.57 +prepare sectors for burning, since all cd burners do at least CIRC,
4.58 +delaying and swaps. For data sectors they also do scrambling and f2
4.59 +frame generation.
4.60 +
4.61 +Encoding routines:
4.62 +
4.63 +For data sectors
4.64 + int do_encode_L2(unsigned char *inout, int sectortype, unsigned address);
4.65 +
4.66 + encodes data sectors. The returned data is __unscrambled__ and not in
4.67 + F2-frame format.
4.68 +
4.69 +Parameters are:
4.70 + inout pointer to an array of at least 2352 bytes.
4.71 + sectortype One of the MODE_* constants from ecc.h. This defines
4.72 + how to format the sector.
4.73 + address The logical address to be used in the header
4.74 + (150 = 0:2.0 MSF).
4.75 +
4.76 +NOTE: the data portion has be to aligned properly for performance
4.77 +reasons (see ecc.h for details). So, no moves are necessary here.
4.78 +
4.79 +Generating f2 frames to be used like audio sectors
4.80 + int scramble_L2(unsigned char *inout)
4.81 +
4.82 + generates f2 frames in place from sectors generated by do_encode_L2().
4.83 +
4.84 +Parameters are:
4.85 + inout pointer to an array of at least 2352 bytes.
4.86 +
4.87 +
4.88 +
4.89 +For sub channels
4.90 + int do_encode_sub(unsigned char in[LSUB_RAW*PACKETS_PER_SUBCHANNELFRAME],
4.91 + unsigned char out[(LSUB_RAW+LSUB_Q+LSUB_P)*
4.92 + PACKETS_PER_SUBCHANNELFRAME],
4.93 + int delay1, int permute);
4.94 +
4.95 + repack user data and add error correction data. P and q subchannels
4.96 +should be added later, since all bytes are in place then.
4.97 +
4.98 +Parameters are:
4.99 + in pointer to an array of at least 72 bytes. It contains
4.100 + the user data for one frame.
4.101 + out pointer to an array of at least 96 bytes. Here is
4.102 + output frame is placed.
4.103 + delay1 do low level delaying, when set to 1.
4.104 + permute do low level permutations, when set to 1.
4.105 +
4.106 +NOTE: Probably both options need either to be set on (1) or off (0) together.
4.107 +
4.108 +There is more, but that is seldomly used.
4.109 +
4.110 +Tests:
4.111 +The library is accompanied by small verify programs, that compare real
4.112 +raw sectors with the formatted results. They are also intended as demo
4.113 +applications (how to use the library). In order to be able to feed
4.114 +real raw sectors into them, the package read2448 is recommended/needed.
4.115 +You can only verify sector streams of one sector type, currently no mix.
4.116 +
4.117 +For more information have a look into ecc.h
4.118 +
4.119 +recommended Documents:
4.120 +Yellow Book or ISO 10149
4.121 +Appendix Red Book
4.122 +Red Book or IEC 908
4.123 +
4.124 +Source: libedc/README from cdrtools package
4.125 +Edited for cdrkit by Christian Fromme <kaner@strace.org>
4.126 +
5.1 --- a/src/gdrom/cdi.c Tue Feb 26 01:10:48 2008 +0000
5.2 +++ b/src/gdrom/cdi.c Sun Mar 02 11:38:08 2008 +0000
5.3 @@ -171,11 +171,11 @@
5.4 image->track[total_tracks].flags = 0x41;
5.5 switch( trk.sector_size ) {
5.6 case 0:
5.7 - image->track[total_tracks].mode = GDROM_MODE2_XA1;
5.8 + image->track[total_tracks].mode = GDROM_MODE2_FORM1;
5.9 image->track[total_tracks].sector_size = 2048;
5.10 break;
5.11 case 1:
5.12 - image->track[total_tracks].mode = GDROM_MODE2;
5.13 + image->track[total_tracks].mode = GDROM_SEMIRAW_MODE2;
5.14 image->track[total_tracks].sector_size = 2336;
5.15 break;
5.16 case 2:
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/src/gdrom/ecc.h Sun Mar 02 11:38:08 2008 +0000
6.3 @@ -0,0 +1,136 @@
6.4 +/*
6.5 + * This file has been modified for the cdrkit suite.
6.6 + *
6.7 + * The behaviour and appearence of the program code below can differ to a major
6.8 + * extent from the version distributed by the original author(s).
6.9 + *
6.10 + * For details, see Changelog file distributed with the cdrkit package. If you
6.11 + * received this file from another source then ask the distributing person for
6.12 + * a log of modifications.
6.13 + *
6.14 + */
6.15 +
6.16 +/* @(#)ecc.h 1.4 02/10/19 Copyright 1998-2002 Heiko Eissfeldt, Joerg Schilling */
6.17 +
6.18 +/*
6.19 + * compact disc reed-solomon routines
6.20 + *
6.21 + * (c) 1998-2002 by Heiko Eissfeldt, heiko@colossus.escape.de
6.22 + * (c) 2002 by Joerg Schilling
6.23 + */
6.24 +/*
6.25 + * This program is free software; you can redistribute it and/or modify
6.26 + * it under the terms of the GNU General Public License version 2
6.27 + * as published by the Free Software Foundation.
6.28 + *
6.29 + * This program is distributed in the hope that it will be useful,
6.30 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
6.31 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6.32 + * GNU General Public License for more details.
6.33 + *
6.34 + * You should have received a copy of the GNU General Public License along with
6.35 + * this program; see the file COPYING. If not, write to the Free Software
6.36 + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
6.37 + */
6.38 +
6.39 +#define RS_L12_BITS 8
6.40 +
6.41 +/* audio sector definitions for CIRC */
6.42 +#define FRAMES_PER_SECTOR 98
6.43 +/* user data bytes per frame */
6.44 +#define L1_RAW 24
6.45 +/* parity bytes with 8 bit */
6.46 +#define L1_Q 4
6.47 +#define L1_P 4
6.48 +
6.49 +int cd_build_address(unsigned char inout[], int sectortype, unsigned address);
6.50 +
6.51 +/* audio sector Cross Interleaved Reed-Solomon Code (CIRC) encoder (layer 1) */
6.52 +/* adds P- and Q- parity information to audio (f2) frames. Also
6.53 + optionally handles the various delays and permutations. The output with all
6.54 + stages enabled can be fed into the Eight-Fourteen-Modulator.
6.55 + On input: 2352 bytes of audio data is given.
6.56 + On output: 3136 bytes of CIRC enriched audio data are returned.
6.57 + */
6.58 +int do_encode_L1(unsigned char in[L1_RAW*FRAMES_PER_SECTOR],
6.59 + unsigned char out[(L1_RAW+L1_Q+L1_P)*FRAMES_PER_SECTOR],
6.60 + int delay1, int delay2, int delay3, int scramble);
6.61 +
6.62 +/* data sector definitions for RSPC */
6.63 +/* user data bytes per frame */
6.64 +#define L2_RAW (1024*2)
6.65 +/* parity bytes for 16 bit units */
6.66 +#define L2_Q (26*2*2)
6.67 +#define L2_P (43*2*2)
6.68 +
6.69 +/* known sector types */
6.70 +#define MODE_0 GDROM_MODE0
6.71 +#define MODE_1 GDROM_MODE1
6.72 +#define MODE_2 GDROM_MODE2_FORMLESS
6.73 +#define MODE_2_FORM_1 GDROM_MODE2_FORM1
6.74 +#define MODE_2_FORM_2 GDROM_MODE2_FORM2
6.75 +
6.76 +/* set one of the MODE_* constants for subsequent data sector formatting */
6.77 +int set_sector_type(int st);
6.78 +/* get the current sector type setting for data sector formatting */
6.79 +int get_sector_type(void);
6.80 +
6.81 +/* data sector layer 2 Reed-Solomon Product Code encoder */
6.82 +/* encode the given data portion depending on sector type (see
6.83 + get/set_sector_type() functions). Use the given address for the header.
6.84 + The returned data is __unscrambled__ and not in F2-frame format (for that
6.85 + see function scramble_L2()).
6.86 + Supported sector types:
6.87 + MODE_0: a 12-byte sync field, a header and 2336 zeros are returned.
6.88 + MODE_1: the user data portion (2048 bytes) has to be given
6.89 + at offset 16 in the inout array.
6.90 + Sync-, header-, edc-, spare-, p- and q- fields will be added.
6.91 + MODE_2: the user data portion (2336 bytes) has to be given
6.92 + at offset 16 in the inout array.
6.93 + Sync- and header- fields will be added.
6.94 + MODE_2_FORM_1: the user data portion (8 bytes subheader followed
6.95 + by 2048 bytes data) has to be given at offset 16
6.96 + in the inout array.
6.97 + Sync-, header-, edc-, p- and q- fields will be added.
6.98 + MODE_2_FORM_2: the user data portion (8 bytes subheader followed
6.99 + by 2324 bytes data) has to be given at offset 16
6.100 + in the inout array.
6.101 + Sync-, header- and edc- fields will be added.
6.102 +*/
6.103 +int do_encode_L2(unsigned char *inout, int sectortype, unsigned address);
6.104 +int decode_L2_Q(unsigned char inout[4 + L2_RAW + 12 + L2_Q]);
6.105 +int decode_L2_P(unsigned char inout[4 + L2_RAW + 12 + L2_Q + L2_P]);
6.106 +unsigned int build_edc(unsigned char inout[], int from, int upto);
6.107 +
6.108 +/* generates f2 frames from otherwise fully formatted sectors (generated by
6.109 + do_encode_L2()). */
6.110 +#define EDC_SCRAMBLE_NOSWAP 1 /* Do not swap bytes while scrambling */
6.111 +int scramble_L2(unsigned char *inout);
6.112 +
6.113 +/* r-w sub channel definitions */
6.114 +#define RS_SUB_RW_BITS 6
6.115 +
6.116 +#define PACKETS_PER_SUBCHANNELFRAME 4
6.117 +#define LSUB_RAW 18
6.118 +#define LSUB_QRAW 2
6.119 +/* 6 bit */
6.120 +#define LSUB_Q 2
6.121 +#define LSUB_P 4
6.122 +
6.123 +/* R-W subchannel encoder */
6.124 +/* On input: 72 bytes packed user data, four frames with each 18 bytes.
6.125 + On output: per frame: 2 bytes user data, 2 bytes Q parity,
6.126 + 16 bytes user data, 4 bytes P parity.
6.127 + Options:
6.128 + delay1: use low level delay line
6.129 + scramble: perform low level permutations
6.130 + */
6.131 +int do_encode_sub(unsigned char in[LSUB_RAW*PACKETS_PER_SUBCHANNELFRAME],
6.132 + unsigned char out[(LSUB_RAW+LSUB_Q+LSUB_P)*PACKETS_PER_SUBCHANNELFRAME],
6.133 + int delay1, int scramble);
6.134 +int do_decode_sub(unsigned char in[(LSUB_RAW+LSUB_Q+LSUB_P)*PACKETS_PER_SUBCHANNELFRAME],
6.135 + unsigned char out[LSUB_RAW*PACKETS_PER_SUBCHANNELFRAME],
6.136 + int delay1, int scramble);
6.137 +
6.138 +int decode_LSUB_Q(unsigned char inout[LSUB_QRAW + LSUB_Q]);
6.139 +int decode_LSUB_P(unsigned char inout[LSUB_RAW + LSUB_Q + LSUB_P]);
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/src/gdrom/edc_crctable.h Sun Mar 02 11:38:08 2008 +0000
7.3 @@ -0,0 +1,171 @@
7.4 +/* @(#)crctable.out 1.2 02/10/17 joerg */
7.5 +
7.6 +/*****************************************************************/
7.7 +/* */
7.8 +/* CRC LOOKUP TABLE */
7.9 +/* ================ */
7.10 +/* The following CRC lookup table was generated automagically */
7.11 +/* by the Rocksoft^tm Model CRC Algorithm Table Generation */
7.12 +/* Program V1.0 using the following model parameters: */
7.13 +/* */
7.14 +/* Width : 4 bytes. */
7.15 +/* Poly : 0x8001801BL */
7.16 +/* Reverse : TRUE. */
7.17 +/* */
7.18 +/* For more information on the Rocksoft^tm Model CRC Algorithm, */
7.19 +/* see the document titled "A Painless Guide to CRC Error */
7.20 +/* Detection Algorithms" by Ross Williams */
7.21 +/* (ross@guest.adelaide.edu.au.). This document is likely to be */
7.22 +/* in the FTP archive "ftp.adelaide.edu.au/pub/rocksoft". */
7.23 +/* */
7.24 +/*****************************************************************/
7.25 +
7.26 +#ifdef PROTOTYPES
7.27 +
7.28 +static unsigned int EDC_crctable[256] =
7.29 +{
7.30 + 0x00000000U, 0x90910101U, 0x91210201U, 0x01B00300U,
7.31 + 0x92410401U, 0x02D00500U, 0x03600600U, 0x93F10701U,
7.32 + 0x94810801U, 0x04100900U, 0x05A00A00U, 0x95310B01U,
7.33 + 0x06C00C00U, 0x96510D01U, 0x97E10E01U, 0x07700F00U,
7.34 + 0x99011001U, 0x09901100U, 0x08201200U, 0x98B11301U,
7.35 + 0x0B401400U, 0x9BD11501U, 0x9A611601U, 0x0AF01700U,
7.36 + 0x0D801800U, 0x9D111901U, 0x9CA11A01U, 0x0C301B00U,
7.37 + 0x9FC11C01U, 0x0F501D00U, 0x0EE01E00U, 0x9E711F01U,
7.38 + 0x82012001U, 0x12902100U, 0x13202200U, 0x83B12301U,
7.39 + 0x10402400U, 0x80D12501U, 0x81612601U, 0x11F02700U,
7.40 + 0x16802800U, 0x86112901U, 0x87A12A01U, 0x17302B00U,
7.41 + 0x84C12C01U, 0x14502D00U, 0x15E02E00U, 0x85712F01U,
7.42 + 0x1B003000U, 0x8B913101U, 0x8A213201U, 0x1AB03300U,
7.43 + 0x89413401U, 0x19D03500U, 0x18603600U, 0x88F13701U,
7.44 + 0x8F813801U, 0x1F103900U, 0x1EA03A00U, 0x8E313B01U,
7.45 + 0x1DC03C00U, 0x8D513D01U, 0x8CE13E01U, 0x1C703F00U,
7.46 + 0xB4014001U, 0x24904100U, 0x25204200U, 0xB5B14301U,
7.47 + 0x26404400U, 0xB6D14501U, 0xB7614601U, 0x27F04700U,
7.48 + 0x20804800U, 0xB0114901U, 0xB1A14A01U, 0x21304B00U,
7.49 + 0xB2C14C01U, 0x22504D00U, 0x23E04E00U, 0xB3714F01U,
7.50 + 0x2D005000U, 0xBD915101U, 0xBC215201U, 0x2CB05300U,
7.51 + 0xBF415401U, 0x2FD05500U, 0x2E605600U, 0xBEF15701U,
7.52 + 0xB9815801U, 0x29105900U, 0x28A05A00U, 0xB8315B01U,
7.53 + 0x2BC05C00U, 0xBB515D01U, 0xBAE15E01U, 0x2A705F00U,
7.54 + 0x36006000U, 0xA6916101U, 0xA7216201U, 0x37B06300U,
7.55 + 0xA4416401U, 0x34D06500U, 0x35606600U, 0xA5F16701U,
7.56 + 0xA2816801U, 0x32106900U, 0x33A06A00U, 0xA3316B01U,
7.57 + 0x30C06C00U, 0xA0516D01U, 0xA1E16E01U, 0x31706F00U,
7.58 + 0xAF017001U, 0x3F907100U, 0x3E207200U, 0xAEB17301U,
7.59 + 0x3D407400U, 0xADD17501U, 0xAC617601U, 0x3CF07700U,
7.60 + 0x3B807800U, 0xAB117901U, 0xAAA17A01U, 0x3A307B00U,
7.61 + 0xA9C17C01U, 0x39507D00U, 0x38E07E00U, 0xA8717F01U,
7.62 + 0xD8018001U, 0x48908100U, 0x49208200U, 0xD9B18301U,
7.63 + 0x4A408400U, 0xDAD18501U, 0xDB618601U, 0x4BF08700U,
7.64 + 0x4C808800U, 0xDC118901U, 0xDDA18A01U, 0x4D308B00U,
7.65 + 0xDEC18C01U, 0x4E508D00U, 0x4FE08E00U, 0xDF718F01U,
7.66 + 0x41009000U, 0xD1919101U, 0xD0219201U, 0x40B09300U,
7.67 + 0xD3419401U, 0x43D09500U, 0x42609600U, 0xD2F19701U,
7.68 + 0xD5819801U, 0x45109900U, 0x44A09A00U, 0xD4319B01U,
7.69 + 0x47C09C00U, 0xD7519D01U, 0xD6E19E01U, 0x46709F00U,
7.70 + 0x5A00A000U, 0xCA91A101U, 0xCB21A201U, 0x5BB0A300U,
7.71 + 0xC841A401U, 0x58D0A500U, 0x5960A600U, 0xC9F1A701U,
7.72 + 0xCE81A801U, 0x5E10A900U, 0x5FA0AA00U, 0xCF31AB01U,
7.73 + 0x5CC0AC00U, 0xCC51AD01U, 0xCDE1AE01U, 0x5D70AF00U,
7.74 + 0xC301B001U, 0x5390B100U, 0x5220B200U, 0xC2B1B301U,
7.75 + 0x5140B400U, 0xC1D1B501U, 0xC061B601U, 0x50F0B700U,
7.76 + 0x5780B800U, 0xC711B901U, 0xC6A1BA01U, 0x5630BB00U,
7.77 + 0xC5C1BC01U, 0x5550BD00U, 0x54E0BE00U, 0xC471BF01U,
7.78 + 0x6C00C000U, 0xFC91C101U, 0xFD21C201U, 0x6DB0C300U,
7.79 + 0xFE41C401U, 0x6ED0C500U, 0x6F60C600U, 0xFFF1C701U,
7.80 + 0xF881C801U, 0x6810C900U, 0x69A0CA00U, 0xF931CB01U,
7.81 + 0x6AC0CC00U, 0xFA51CD01U, 0xFBE1CE01U, 0x6B70CF00U,
7.82 + 0xF501D001U, 0x6590D100U, 0x6420D200U, 0xF4B1D301U,
7.83 + 0x6740D400U, 0xF7D1D501U, 0xF661D601U, 0x66F0D700U,
7.84 + 0x6180D800U, 0xF111D901U, 0xF0A1DA01U, 0x6030DB00U,
7.85 + 0xF3C1DC01U, 0x6350DD00U, 0x62E0DE00U, 0xF271DF01U,
7.86 + 0xEE01E001U, 0x7E90E100U, 0x7F20E200U, 0xEFB1E301U,
7.87 + 0x7C40E400U, 0xECD1E501U, 0xED61E601U, 0x7DF0E700U,
7.88 + 0x7A80E800U, 0xEA11E901U, 0xEBA1EA01U, 0x7B30EB00U,
7.89 + 0xE8C1EC01U, 0x7850ED00U, 0x79E0EE00U, 0xE971EF01U,
7.90 + 0x7700F000U, 0xE791F101U, 0xE621F201U, 0x76B0F300U,
7.91 + 0xE541F401U, 0x75D0F500U, 0x7460F600U, 0xE4F1F701U,
7.92 + 0xE381F801U, 0x7310F900U, 0x72A0FA00U, 0xE231FB01U,
7.93 + 0x71C0FC00U, 0xE151FD01U, 0xE0E1FE01U, 0x7070FF00U,
7.94 +};
7.95 +
7.96 +/*****************************************************************/
7.97 +/* End of CRC Lookup Table */
7.98 +/*****************************************************************/
7.99 +
7.100 +#else /* PROTOTYPES */
7.101 +
7.102 +static unsigned int EDC_crctable[256] =
7.103 +{
7.104 + 0x00000000, 0x90910101, 0x91210201, 0x01B00300,
7.105 + 0x92410401, 0x02D00500, 0x03600600, 0x93F10701,
7.106 + 0x94810801, 0x04100900, 0x05A00A00, 0x95310B01,
7.107 + 0x06C00C00, 0x96510D01, 0x97E10E01, 0x07700F00,
7.108 + 0x99011001, 0x09901100, 0x08201200, 0x98B11301,
7.109 + 0x0B401400, 0x9BD11501, 0x9A611601, 0x0AF01700,
7.110 + 0x0D801800, 0x9D111901, 0x9CA11A01, 0x0C301B00,
7.111 + 0x9FC11C01, 0x0F501D00, 0x0EE01E00, 0x9E711F01,
7.112 + 0x82012001, 0x12902100, 0x13202200, 0x83B12301,
7.113 + 0x10402400, 0x80D12501, 0x81612601, 0x11F02700,
7.114 + 0x16802800, 0x86112901, 0x87A12A01, 0x17302B00,
7.115 + 0x84C12C01, 0x14502D00, 0x15E02E00, 0x85712F01,
7.116 + 0x1B003000, 0x8B913101, 0x8A213201, 0x1AB03300,
7.117 + 0x89413401, 0x19D03500, 0x18603600, 0x88F13701,
7.118 + 0x8F813801, 0x1F103900, 0x1EA03A00, 0x8E313B01,
7.119 + 0x1DC03C00, 0x8D513D01, 0x8CE13E01, 0x1C703F00,
7.120 + 0xB4014001, 0x24904100, 0x25204200, 0xB5B14301,
7.121 + 0x26404400, 0xB6D14501, 0xB7614601, 0x27F04700,
7.122 + 0x20804800, 0xB0114901, 0xB1A14A01, 0x21304B00,
7.123 + 0xB2C14C01, 0x22504D00, 0x23E04E00, 0xB3714F01,
7.124 + 0x2D005000, 0xBD915101, 0xBC215201, 0x2CB05300,
7.125 + 0xBF415401, 0x2FD05500, 0x2E605600, 0xBEF15701,
7.126 + 0xB9815801, 0x29105900, 0x28A05A00, 0xB8315B01,
7.127 + 0x2BC05C00, 0xBB515D01, 0xBAE15E01, 0x2A705F00,
7.128 + 0x36006000, 0xA6916101, 0xA7216201, 0x37B06300,
7.129 + 0xA4416401, 0x34D06500, 0x35606600, 0xA5F16701,
7.130 + 0xA2816801, 0x32106900, 0x33A06A00, 0xA3316B01,
7.131 + 0x30C06C00, 0xA0516D01, 0xA1E16E01, 0x31706F00,
7.132 + 0xAF017001, 0x3F907100, 0x3E207200, 0xAEB17301,
7.133 + 0x3D407400, 0xADD17501, 0xAC617601, 0x3CF07700,
7.134 + 0x3B807800, 0xAB117901, 0xAAA17A01, 0x3A307B00,
7.135 + 0xA9C17C01, 0x39507D00, 0x38E07E00, 0xA8717F01,
7.136 + 0xD8018001, 0x48908100, 0x49208200, 0xD9B18301,
7.137 + 0x4A408400, 0xDAD18501, 0xDB618601, 0x4BF08700,
7.138 + 0x4C808800, 0xDC118901, 0xDDA18A01, 0x4D308B00,
7.139 + 0xDEC18C01, 0x4E508D00, 0x4FE08E00, 0xDF718F01,
7.140 + 0x41009000, 0xD1919101, 0xD0219201, 0x40B09300,
7.141 + 0xD3419401, 0x43D09500, 0x42609600, 0xD2F19701,
7.142 + 0xD5819801, 0x45109900, 0x44A09A00, 0xD4319B01,
7.143 + 0x47C09C00, 0xD7519D01, 0xD6E19E01, 0x46709F00,
7.144 + 0x5A00A000, 0xCA91A101, 0xCB21A201, 0x5BB0A300,
7.145 + 0xC841A401, 0x58D0A500, 0x5960A600, 0xC9F1A701,
7.146 + 0xCE81A801, 0x5E10A900, 0x5FA0AA00, 0xCF31AB01,
7.147 + 0x5CC0AC00, 0xCC51AD01, 0xCDE1AE01, 0x5D70AF00,
7.148 + 0xC301B001, 0x5390B100, 0x5220B200, 0xC2B1B301,
7.149 + 0x5140B400, 0xC1D1B501, 0xC061B601, 0x50F0B700,
7.150 + 0x5780B800, 0xC711B901, 0xC6A1BA01, 0x5630BB00,
7.151 + 0xC5C1BC01, 0x5550BD00, 0x54E0BE00, 0xC471BF01,
7.152 + 0x6C00C000, 0xFC91C101, 0xFD21C201, 0x6DB0C300,
7.153 + 0xFE41C401, 0x6ED0C500, 0x6F60C600, 0xFFF1C701,
7.154 + 0xF881C801, 0x6810C900, 0x69A0CA00, 0xF931CB01,
7.155 + 0x6AC0CC00, 0xFA51CD01, 0xFBE1CE01, 0x6B70CF00,
7.156 + 0xF501D001, 0x6590D100, 0x6420D200, 0xF4B1D301,
7.157 + 0x6740D400, 0xF7D1D501, 0xF661D601, 0x66F0D700,
7.158 + 0x6180D800, 0xF111D901, 0xF0A1DA01, 0x6030DB00,
7.159 + 0xF3C1DC01, 0x6350DD00, 0x62E0DE00, 0xF271DF01,
7.160 + 0xEE01E001, 0x7E90E100, 0x7F20E200, 0xEFB1E301,
7.161 + 0x7C40E400, 0xECD1E501, 0xED61E601, 0x7DF0E700,
7.162 + 0x7A80E800, 0xEA11E901, 0xEBA1EA01, 0x7B30EB00,
7.163 + 0xE8C1EC01, 0x7850ED00, 0x79E0EE00, 0xE971EF01,
7.164 + 0x7700F000, 0xE791F101, 0xE621F201, 0x76B0F300,
7.165 + 0xE541F401, 0x75D0F500, 0x7460F600, 0xE4F1F701,
7.166 + 0xE381F801, 0x7310F900, 0x72A0FA00, 0xE231FB01,
7.167 + 0x71C0FC00, 0xE151FD01, 0xE0E1FE01, 0x7070FF00,
7.168 +};
7.169 +
7.170 +#endif /* PROTOTYPES */
7.171 +
7.172 +/*****************************************************************/
7.173 +/* End of CRC Lookup Table */
7.174 +/*****************************************************************/
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
8.2 +++ b/src/gdrom/edc_ecc.c Sun Mar 02 11:38:08 2008 +0000
8.3 @@ -0,0 +1,979 @@
8.4 +/*
8.5 + * Note: This file has been extracted from crkit 1.1.6 and modified to work within
8.6 + * lxdream, but is otherwise unchanged.
8.7 + */
8.8 +/*
8.9 + * This file has been modified for the cdrkit suite.
8.10 + *
8.11 + * The behaviour and appearence of the program code below can differ to a major
8.12 + * extent from the version distributed by the original author(s).
8.13 + *
8.14 + * For details, see Changelog file distributed with the cdrkit package. If you
8.15 + * received this file from another source then ask the distributing person for
8.16 + * a log of modifications.
8.17 + *
8.18 + */
8.19 +
8.20 +/* @(#)edc_ecc.c 1.21 03/04/04 Copyright 1998-2002 Heiko Eissfeldt, Joerg Schilling */
8.21 +
8.22 +/*
8.23 + * Copyright 1998-2002 by Heiko Eissfeldt
8.24 + * Copyright 2002 by Joerg Schilling
8.25 + *
8.26 + * This file contains protected intellectual property.
8.27 + *
8.28 + * reed-solomon encoder / decoder for compact discs.
8.29 + *
8.30 + */
8.31 +/*
8.32 + * This program is free software; you can redistribute it and/or modify
8.33 + * it under the terms of the GNU General Public License version 2
8.34 + * as published by the Free Software Foundation.
8.35 + *
8.36 + * This program is distributed in the hope that it will be useful,
8.37 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
8.38 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8.39 + * GNU General Public License for more details.
8.40 + *
8.41 + * You should have received a copy of the GNU General Public License along with
8.42 + * this program; see the file COPYING. If not, write to the Free Software
8.43 + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
8.44 + */
8.45 +
8.46 +#include <stdint.h>
8.47 +#include <stdio.h>
8.48 +#include <string.h>
8.49 +#include "gdrom.h"
8.50 +#include "ecc.h"
8.51 +
8.52 +#define xaligned(a, s) ((((uintptr_t)(a)) & (s)) == 0 )
8.53 +
8.54 +/* these prototypes will become public when the function are implemented */
8.55 +static int do_decode_L2(unsigned char in[(L2_RAW+L2_Q+L2_P)],
8.56 + unsigned char out[L2_RAW]);
8.57 +
8.58 +static int do_decode_L1(unsigned char in[(L1_RAW+L1_Q+L1_P)*FRAMES_PER_SECTOR],
8.59 + unsigned char out[L1_RAW*FRAMES_PER_SECTOR],
8.60 + int delay1, int delay2, int delay3, int scramble);
8.61 +
8.62 +
8.63 +/* ------------- tables generated by gen_encodes --------------*/
8.64 +
8.65 +#include "edc_scramble.h"
8.66 +
8.67 +#define DO4(a) a;a;a;a;
8.68 +#define DO13(a) a;a;a;a;a;a;a;a;a;a;a;a;a;
8.69 +
8.70 +/*
8.71 + * Scrambles 2352 - 12 = 2340 bytes
8.72 + */
8.73 +int scramble_L2(unsigned char *inout);
8.74 +
8.75 +int scramble_L2(unsigned char *inout)
8.76 +{
8.77 +#ifndef EDC_SCRAMBLE_NOSWAP
8.78 + unsigned int *f = (unsigned int *)inout;
8.79 +#endif
8.80 +
8.81 + if (!xaligned(inout + 12, sizeof(uint32_t)-1)) {
8.82 +
8.83 + uint8_t *r = inout + 12;
8.84 + const uint8_t *s = yellowbook_scrambler;
8.85 + register int i;
8.86 +
8.87 + for (i = (L2_RAW + L2_Q + L2_P +16)/sizeof(unsigned char)/4; --i >= 0;) {
8.88 + DO4(*r++ ^= *s++);
8.89 + }
8.90 +
8.91 + } else {
8.92 + uint32_t *r = (uint32_t *) (inout + 12);
8.93 + const uint32_t *s = yellowbook_scrambler_uint32;
8.94 + register int i;
8.95 +
8.96 + for (i = (L2_RAW + L2_Q + L2_P +16)/sizeof(uint32_t)/13; --i >= 0;) {
8.97 + DO13(*r++ ^= *s++);
8.98 + }
8.99 + }
8.100 +
8.101 +#ifndef EDC_SCRAMBLE_NOSWAP
8.102 +
8.103 + /* generate F1 frames */
8.104 + for (i = 2352/sizeof(unsigned int); i; i--) {
8.105 + *f++ = ((*f & 0xff00ff00UL) >> 8) | ((*f & 0x00ff00ffUL) << 8);
8.106 + }
8.107 +#endif
8.108 +
8.109 + return (0);
8.110 +}
8.111 +
8.112 +#include "edc_l2sq.h"
8.113 +
8.114 +static int encode_L2_Q(unsigned char inout[4 + L2_RAW + 4 + 8 + L2_P + L2_Q]);
8.115 +
8.116 +static int encode_L2_Q(unsigned char inout[4 + L2_RAW + 4 + 8 + L2_P + L2_Q])
8.117 +{
8.118 + unsigned char *dps;
8.119 + unsigned char *dp;
8.120 + unsigned char *Q;
8.121 + register int i;
8.122 + int j;
8.123 +
8.124 + Q = inout + 4 + L2_RAW + 4 + 8 + L2_P;
8.125 +
8.126 + dps = inout;
8.127 + for (j = 0; j < 26; j++) {
8.128 + register unsigned short a;
8.129 + register unsigned short b;
8.130 + a = b = 0;
8.131 +
8.132 + dp = dps;
8.133 + for (i = 0; i < 43; i++) {
8.134 +
8.135 + /* LSB */
8.136 + a ^= L2sq[i][*dp++];
8.137 +
8.138 + /* MSB */
8.139 + b ^= L2sq[i][*dp];
8.140 +
8.141 + dp += 2*44-1;
8.142 + if (dp >= &inout[(4 + L2_RAW + 4 + 8 + L2_P)]) {
8.143 + dp -= (4 + L2_RAW + 4 + 8 + L2_P);
8.144 + }
8.145 + }
8.146 + Q[0] = a >> 8;
8.147 + Q[26*2] = a;
8.148 + Q[1] = b >> 8;
8.149 + Q[26*2+1] = b;
8.150 +
8.151 + Q += 2;
8.152 + dps += 2*43;
8.153 + }
8.154 + return (0);
8.155 +}
8.156 +
8.157 +static int encode_L2_P(unsigned char inout[4 + L2_RAW + 4 + 8 + L2_P]);
8.158 +
8.159 +static int encode_L2_P(unsigned char inout[4 + L2_RAW + 4 + 8 + L2_P])
8.160 +{
8.161 + unsigned char *dp;
8.162 + unsigned char *P;
8.163 + register int i;
8.164 + int j;
8.165 +
8.166 + P = inout + 4 + L2_RAW + 4 + 8;
8.167 +
8.168 + for (j = 0; j < 43; j++) {
8.169 + register unsigned short a;
8.170 + register unsigned short b;
8.171 +
8.172 + a = b = 0;
8.173 + dp = inout;
8.174 + for (i = 19; i < 43; i++) {
8.175 +
8.176 + /* LSB */
8.177 + a ^= L2sq[i][*dp++];
8.178 +
8.179 + /* MSB */
8.180 + b ^= L2sq[i][*dp];
8.181 +
8.182 + dp += 2*43 -1;
8.183 + }
8.184 + P[0] = a >> 8;
8.185 + P[43*2] = a;
8.186 + P[1] = b >> 8;
8.187 + P[43*2+1] = b;
8.188 +
8.189 + P += 2;
8.190 + inout += 2;
8.191 + }
8.192 + return (0);
8.193 +}
8.194 +
8.195 +static unsigned char bin2bcd(unsigned p);
8.196 +
8.197 +static unsigned char bin2bcd(unsigned p)
8.198 +{
8.199 + return ((p/10)<<4)|(p%10);
8.200 +}
8.201 +
8.202 +int cd_build_address(unsigned char inout[], int sectortype, unsigned address)
8.203 +{
8.204 + inout[12] = bin2bcd(address / (60*75));
8.205 + inout[13] = bin2bcd((address / 75) % 60);
8.206 + inout[14] = bin2bcd(address % 75);
8.207 + if (sectortype == MODE_0)
8.208 + inout[15] = 0;
8.209 + else if (sectortype == MODE_1)
8.210 + inout[15] = 1;
8.211 + else if (sectortype == MODE_2)
8.212 + inout[15] = 2;
8.213 + else if (sectortype == MODE_2_FORM_1)
8.214 + inout[15] = 2;
8.215 + else if (sectortype == MODE_2_FORM_2)
8.216 + inout[15] = 2;
8.217 + else
8.218 + return (-1);
8.219 + return (0);
8.220 +}
8.221 +
8.222 +#include "edc_crctable.h"
8.223 +
8.224 +/*
8.225 + * Called with 2064, 2056 or 2332 byte difference - all dividable by 4.
8.226 + */
8.227 +unsigned int build_edc(unsigned char inout[], int from, int upto);
8.228 +
8.229 +unsigned int build_edc(unsigned char inout[], int from, int upto)
8.230 +{
8.231 + unsigned char *p = inout+from;
8.232 + unsigned int result = 0;
8.233 +
8.234 + upto -= from-1;
8.235 + upto /= 4;
8.236 + while (--upto >= 0) {
8.237 + result = EDC_crctable[(result ^ *p++) & 0xffL] ^ (result >> 8);
8.238 + result = EDC_crctable[(result ^ *p++) & 0xffL] ^ (result >> 8);
8.239 + result = EDC_crctable[(result ^ *p++) & 0xffL] ^ (result >> 8);
8.240 + result = EDC_crctable[(result ^ *p++) & 0xffL] ^ (result >> 8);
8.241 + }
8.242 + return (result);
8.243 +}
8.244 +
8.245 +/* Layer 2 Product code en/decoder */
8.246 +int do_encode_L2(unsigned char inout[(12 + 4 + L2_RAW+4+8+L2_Q+L2_P)],
8.247 + int sectortype, unsigned address);
8.248 +
8.249 +int
8.250 +do_encode_L2(unsigned char inout[(12 + 4 + L2_RAW+4+8+L2_Q+L2_P)],
8.251 + int sectortype, unsigned address)
8.252 +{
8.253 + unsigned int result;
8.254 +
8.255 +/* SYNCPATTERN "\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" */
8.256 +#define SYNCPATTERN "\000\377\377\377\377\377\377\377\377\377\377"
8.257 +
8.258 + /* supply initial sync pattern */
8.259 + memcpy(inout, SYNCPATTERN, sizeof(SYNCPATTERN));
8.260 +
8.261 + if (sectortype == MODE_0) {
8.262 + memset(inout + sizeof(SYNCPATTERN), 0, 4 + L2_RAW + 12 + L2_P + L2_Q);
8.263 + cd_build_address(inout, sectortype, address);
8.264 + return (0);
8.265 + }
8.266 +
8.267 + switch (sectortype) {
8.268 +
8.269 + case MODE_1:
8.270 + cd_build_address(inout, sectortype, address);
8.271 + result = build_edc(inout, 0, 16+2048-1);
8.272 + inout[2064+0] = result >> 0L;
8.273 + inout[2064+1] = result >> 8L;
8.274 + inout[2064+2] = result >> 16L;
8.275 + inout[2064+3] = result >> 24L;
8.276 + memset(inout+2064+4, 0, 8);
8.277 + encode_L2_P(inout+12);
8.278 + encode_L2_Q(inout+12);
8.279 + break;
8.280 + case MODE_2:
8.281 + cd_build_address(inout, sectortype, address);
8.282 + break;
8.283 + case MODE_2_FORM_1:
8.284 + result = build_edc(inout, 16, 16+8+2048-1);
8.285 + inout[2072+0] = result >> 0L;
8.286 + inout[2072+1] = result >> 8L;
8.287 + inout[2072+2] = result >> 16L;
8.288 + inout[2072+3] = result >> 24L;
8.289 +
8.290 + /* clear header for P/Q parity calculation */
8.291 + inout[12] = 0;
8.292 + inout[12+1] = 0;
8.293 + inout[12+2] = 0;
8.294 + inout[12+3] = 0;
8.295 + encode_L2_P(inout+12);
8.296 + encode_L2_Q(inout+12);
8.297 + cd_build_address(inout, sectortype, address);
8.298 + break;
8.299 + case MODE_2_FORM_2:
8.300 + cd_build_address(inout, sectortype, address);
8.301 + result = build_edc(inout, 16, 16+8+2324-1);
8.302 + inout[2348+0] = result >> 0L;
8.303 + inout[2348+1] = result >> 8L;
8.304 + inout[2348+2] = result >> 16L;
8.305 + inout[2348+3] = result >> 24L;
8.306 + break;
8.307 + default:
8.308 + return (-1);
8.309 + }
8.310 +
8.311 + return (0);
8.312 +}
8.313 +
8.314 +
8.315 +/*--------------------------------------------------------------------------*/
8.316 +#include "edc_encoder.h"
8.317 +
8.318 +static int encode_L1_Q(unsigned char inout[L1_RAW + L1_Q]);
8.319 +
8.320 +static int encode_L1_Q(unsigned char inout[L1_RAW + L1_Q])
8.321 +{
8.322 + unsigned char *Q;
8.323 + int i;
8.324 +
8.325 + memmove(inout+L1_RAW/2+L1_Q, inout+L1_RAW/2, L1_RAW/2);
8.326 + Q = inout + L1_RAW/2;
8.327 +
8.328 + memset(Q, 0, L1_Q);
8.329 + for (i = 0; i < L1_RAW + L1_Q; i++) {
8.330 + unsigned char data;
8.331 +
8.332 + if (i == L1_RAW/2) i += L1_Q;
8.333 + data = inout[i];
8.334 + if (data != 0) {
8.335 + unsigned char base = rs_l12_log[data];
8.336 +
8.337 + Q[0] ^= rs_l12_alog[(base+AQ[0][i]) % (unsigned)((1 << RS_L12_BITS)-1)];
8.338 + Q[1] ^= rs_l12_alog[(base+AQ[1][i]) % (unsigned)((1 << RS_L12_BITS)-1)];
8.339 + Q[2] ^= rs_l12_alog[(base+AQ[2][i]) % (unsigned)((1 << RS_L12_BITS)-1)];
8.340 + Q[3] ^= rs_l12_alog[(base+AQ[3][i]) % (unsigned)((1 << RS_L12_BITS)-1)];
8.341 + }
8.342 + }
8.343 + return (0);
8.344 +}
8.345 +
8.346 +static int encode_L1_P(unsigned char inout[L1_RAW + L1_Q + L1_P]);
8.347 +
8.348 +static int encode_L1_P(unsigned char inout[L1_RAW + L1_Q + L1_P])
8.349 +{
8.350 + unsigned char *P;
8.351 + int i;
8.352 +
8.353 + P = inout + L1_RAW + L1_Q;
8.354 +
8.355 + memset(P, 0, L1_P);
8.356 + for (i = 0; i < L2_RAW + L2_Q + L2_P; i++) {
8.357 + unsigned char data;
8.358 +
8.359 + data = inout[i];
8.360 + if (data != 0) {
8.361 + unsigned char base = rs_l12_log[data];
8.362 +
8.363 + P[0] ^= rs_l12_alog[(base+AP[0][i]) % (unsigned)((1 << RS_L12_BITS)-1)];
8.364 + P[1] ^= rs_l12_alog[(base+AP[1][i]) % (unsigned)((1 << RS_L12_BITS)-1)];
8.365 + P[2] ^= rs_l12_alog[(base+AP[2][i]) % (unsigned)((1 << RS_L12_BITS)-1)];
8.366 + P[3] ^= rs_l12_alog[(base+AP[3][i]) % (unsigned)((1 << RS_L12_BITS)-1)];
8.367 + }
8.368 + }
8.369 + return (0);
8.370 +}
8.371 +
8.372 +static int decode_L1_Q(unsigned char inout[L1_RAW + L1_Q]);
8.373 +
8.374 +static int decode_L1_Q(unsigned char inout[L1_RAW + L1_Q])
8.375 +{
8.376 + return (0);
8.377 +}
8.378 +
8.379 +static int decode_L1_P(unsigned char in[L1_RAW + L1_Q + L1_P]);
8.380 +
8.381 +static int decode_L1_P(unsigned char in[L1_RAW + L1_Q + L1_P])
8.382 +{
8.383 + return (0);
8.384 +}
8.385 +
8.386 +int decode_L2_Q(unsigned char inout[4 + L2_RAW + 12 + L2_Q]);
8.387 +
8.388 +int decode_L2_Q(unsigned char inout[4 + L2_RAW + 12 + L2_Q])
8.389 +{
8.390 + return (0);
8.391 +}
8.392 +
8.393 +int decode_L2_P(unsigned char inout[4 + L2_RAW + 12 + L2_Q + L2_P]);
8.394 +
8.395 +int decode_L2_P(unsigned char inout[4 + L2_RAW + 12 + L2_Q + L2_P])
8.396 +{
8.397 + return (0);
8.398 +}
8.399 +
8.400 +static int encode_LSUB_Q(unsigned char inout[LSUB_RAW + LSUB_Q]);
8.401 +
8.402 +static int encode_LSUB_Q(unsigned char inout[LSUB_RAW + LSUB_Q])
8.403 +{
8.404 + unsigned char *Q;
8.405 + int i;
8.406 +
8.407 + memmove(inout+LSUB_QRAW+LSUB_Q, inout+LSUB_QRAW, LSUB_RAW-LSUB_QRAW);
8.408 + Q = inout + LSUB_QRAW;
8.409 +
8.410 + memset(Q, 0, LSUB_Q);
8.411 +
8.412 + for (i = 0; i < LSUB_QRAW; i++) {
8.413 + unsigned char data;
8.414 +
8.415 + data = inout[i] & 0x3f;
8.416 + if (data != 0) {
8.417 + unsigned char base = rs_sub_rw_log[data];
8.418 +
8.419 + Q[0] ^= rs_sub_rw_alog[(base+SQ[0][i]) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];
8.420 + Q[1] ^= rs_sub_rw_alog[(base+SQ[1][i]) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];
8.421 + }
8.422 + }
8.423 + return (0);
8.424 +}
8.425 +
8.426 +
8.427 +static int encode_LSUB_P(unsigned char inout[LSUB_RAW + LSUB_Q + LSUB_P]);
8.428 +
8.429 +static int encode_LSUB_P(unsigned char inout[LSUB_RAW + LSUB_Q + LSUB_P])
8.430 +{
8.431 + unsigned char *P;
8.432 + int i;
8.433 +
8.434 + P = inout + LSUB_RAW + LSUB_Q;
8.435 +
8.436 + memset(P, 0, LSUB_P);
8.437 + for (i = 0; i < LSUB_RAW + LSUB_Q; i++) {
8.438 + unsigned char data;
8.439 +
8.440 + data = inout[i] & 0x3f;
8.441 + if (data != 0) {
8.442 + unsigned char base = rs_sub_rw_log[data];
8.443 +
8.444 + P[0] ^= rs_sub_rw_alog[(base+SP[0][i]) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];
8.445 + P[1] ^= rs_sub_rw_alog[(base+SP[1][i]) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];
8.446 + P[2] ^= rs_sub_rw_alog[(base+SP[2][i]) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];
8.447 + P[3] ^= rs_sub_rw_alog[(base+SP[3][i]) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];
8.448 + }
8.449 + }
8.450 + return (0);
8.451 +}
8.452 +
8.453 +int decode_LSUB_Q(unsigned char inout[LSUB_QRAW + LSUB_Q]);
8.454 +
8.455 +int decode_LSUB_Q(unsigned char inout[LSUB_QRAW + LSUB_Q])
8.456 +{
8.457 + unsigned char Q[LSUB_Q];
8.458 + int i;
8.459 +
8.460 + memset(Q, 0, LSUB_Q);
8.461 + for (i = LSUB_QRAW + LSUB_Q -1; i>=0; i--) {
8.462 + unsigned char data;
8.463 +
8.464 + data = inout[LSUB_QRAW + LSUB_Q -1 -i] & 0x3f;
8.465 + if (data != 0) {
8.466 + unsigned char base = rs_sub_rw_log[data];
8.467 +
8.468 + Q[0] ^= rs_sub_rw_alog[(base+0*i) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];
8.469 + Q[1] ^= rs_sub_rw_alog[(base+1*i) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];
8.470 + }
8.471 + }
8.472 + return (Q[0] != 0 || Q[1] != 0);
8.473 +}
8.474 +
8.475 +int decode_LSUB_P(unsigned char inout[LSUB_RAW + LSUB_Q + LSUB_P]);
8.476 +
8.477 +int decode_LSUB_P(unsigned char inout[LSUB_RAW + LSUB_Q + LSUB_P])
8.478 +{
8.479 + unsigned char P[LSUB_P];
8.480 + int i;
8.481 +
8.482 + memset(P, 0, LSUB_P);
8.483 + for (i = LSUB_RAW + LSUB_Q + LSUB_P-1; i>=0; i--) {
8.484 + unsigned char data;
8.485 +
8.486 + data = inout[LSUB_RAW + LSUB_Q + LSUB_P -1 -i] & 0x3f;
8.487 + if (data != 0) {
8.488 + unsigned char base = rs_sub_rw_log[data];
8.489 +
8.490 + P[0] ^= rs_sub_rw_alog[(base+0*i) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];
8.491 + P[1] ^= rs_sub_rw_alog[(base+1*i) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];
8.492 + P[2] ^= rs_sub_rw_alog[(base+2*i) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];
8.493 + P[3] ^= rs_sub_rw_alog[(base+3*i) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];
8.494 + }
8.495 + }
8.496 + return (P[0] != 0 || P[1] != 0 || P[2] != 0 || P[3] != 0);
8.497 +}
8.498 +
8.499 +/* Layer 1 CIRC en/decoder */
8.500 +#define MAX_L1_DEL1 2
8.501 +static unsigned char l1_delay_line1[MAX_L1_DEL1][L1_RAW];
8.502 +#define MAX_L1_DEL2 108
8.503 +static unsigned char l1_delay_line2[MAX_L1_DEL2][L1_RAW+L1_Q];
8.504 +#define MAX_L1_DEL3 1
8.505 +static unsigned char l1_delay_line3[MAX_L1_DEL3][L1_RAW+L1_Q+L1_P];
8.506 +static unsigned l1_del_index;
8.507 +
8.508 +int do_encode_L1(unsigned char in[L1_RAW*FRAMES_PER_SECTOR],
8.509 + unsigned char out[(L1_RAW+L1_Q+L1_P)*FRAMES_PER_SECTOR],
8.510 + int delay1, int delay2, int delay3, int permute);
8.511 +
8.512 +int do_encode_L1(unsigned char in[L1_RAW*FRAMES_PER_SECTOR],
8.513 + unsigned char out[(L1_RAW+L1_Q+L1_P)*FRAMES_PER_SECTOR],
8.514 + int delay1, int delay2, int delay3, int permute)
8.515 +{
8.516 + int i;
8.517 +
8.518 + for (i = 0; i < FRAMES_PER_SECTOR; i++) {
8.519 + int j;
8.520 + unsigned char t;
8.521 +
8.522 + if (in != out)
8.523 + memcpy(out, in, L1_RAW);
8.524 +
8.525 + if (delay1) {
8.526 + /* shift through delay line 1 */
8.527 + for (j = 0; j < L1_RAW; j++) {
8.528 + if (((j/4) % MAX_L1_DEL1) == 0) {
8.529 + t = l1_delay_line1[l1_del_index % (MAX_L1_DEL1)][j];
8.530 + l1_delay_line1[l1_del_index % (MAX_L1_DEL1)][j] = out[j];
8.531 + out[j] = t;
8.532 + }
8.533 + }
8.534 + }
8.535 +
8.536 + if (permute) {
8.537 + /* permute */
8.538 + t = out[2]; out[2] = out[8]; out[8] = out[10]; out[10] = out[18];
8.539 + out[18] = out[6]; out [6] = t;
8.540 + t = out[3]; out[3] = out[9]; out[9] = out[11]; out[11] = out[19];
8.541 + out[19] = out[7]; out [7] = t;
8.542 + t = out[4]; out[4] = out[16]; out[16] = out[20]; out[20] = out[14];
8.543 + out[14] = out[12]; out [12] = t;
8.544 + t = out[5]; out[5] = out[17]; out[17] = out[21]; out[21] = out[15];
8.545 + out[15] = out[13]; out [13] = t;
8.546 + }
8.547 +
8.548 + /* build Q parity */
8.549 + encode_L1_Q(out);
8.550 +
8.551 + if (delay2) {
8.552 + /* shift through delay line 2 */
8.553 + for (j = 0; j < L1_RAW+L1_Q; j++) {
8.554 + if (j != 0) {
8.555 + t = l1_delay_line2[(l1_del_index) % MAX_L1_DEL2][j];
8.556 + l1_delay_line2[(l1_del_index + j*4) % MAX_L1_DEL2][j] = out[j];
8.557 + out[j] = t;
8.558 + }
8.559 + }
8.560 + }
8.561 +
8.562 + /* build P parity */
8.563 + encode_L1_P(out);
8.564 +
8.565 + if (delay3) {
8.566 + /* shift through delay line 3 */
8.567 + for (j = 0; j < L1_RAW+L1_Q+L1_P; j++) {
8.568 + if (((j) & MAX_L1_DEL3) == 0) {
8.569 + t = l1_delay_line3[0][j];
8.570 + l1_delay_line3[0][j] = out[j];
8.571 + out[j] = t;
8.572 + }
8.573 + }
8.574 + }
8.575 +
8.576 + /* invert Q and P parity */
8.577 + for (j = 0; j < L1_Q; j++)
8.578 + out[j+12] = ~out[j+12];
8.579 + for (j = 0; j < L1_P; j++)
8.580 + out[j+28] = ~out[j+28];
8.581 +
8.582 + l1_del_index++;
8.583 + out += L1_RAW+L1_Q+L1_P;
8.584 + in += L1_RAW;
8.585 + }
8.586 + return (0);
8.587 +}
8.588 +
8.589 +static
8.590 +int do_decode_L1(unsigned char in[(L1_RAW+L1_Q+L1_P)*FRAMES_PER_SECTOR],
8.591 + unsigned char out[L1_RAW*FRAMES_PER_SECTOR],
8.592 + int delay1, int delay2, int delay3, int permute);
8.593 +
8.594 +static /* XXX should be non static XXX*/
8.595 +
8.596 +int do_decode_L1(unsigned char in[(L1_RAW+L1_Q+L1_P)*FRAMES_PER_SECTOR],
8.597 + unsigned char out[L1_RAW*FRAMES_PER_SECTOR],
8.598 + int delay1, int delay2, int delay3, int permute)
8.599 +{
8.600 + int i;
8.601 +
8.602 + for (i = 0; i < FRAMES_PER_SECTOR; i++) {
8.603 + int j;
8.604 + unsigned char t;
8.605 +
8.606 + if (delay3) {
8.607 + /* shift through delay line 3 */
8.608 + for (j = 0; j < L1_RAW+L1_Q+L1_P; j++) {
8.609 + if (((j) & MAX_L1_DEL3) != 0) {
8.610 + t = l1_delay_line3[0][j];
8.611 + l1_delay_line3[0][j] = in[j];
8.612 + in[j] = t;
8.613 + }
8.614 + }
8.615 + }
8.616 +
8.617 + /* invert Q and P parity */
8.618 + for (j = 0; j < L1_Q; j++)
8.619 + in[j+12] = ~in[j+12];
8.620 + for (j = 0; j < L1_P; j++)
8.621 + in[j+28] = ~in[j+28];
8.622 +
8.623 + /* build P parity */
8.624 + decode_L1_P(in);
8.625 +
8.626 + if (delay2) {
8.627 + /* shift through delay line 2 */
8.628 + for (j = 0; j < L1_RAW+L1_Q; j++) {
8.629 + if (j != L1_RAW+L1_Q-1) {
8.630 + t = l1_delay_line2[(l1_del_index) % MAX_L1_DEL2][j];
8.631 + l1_delay_line2[(l1_del_index + (MAX_L1_DEL2 - j*4)) % MAX_L1_DEL2][j] = in[j];
8.632 + in[j] = t;
8.633 + }
8.634 + }
8.635 + }
8.636 +
8.637 + /* build Q parity */
8.638 + decode_L1_Q(in);
8.639 +
8.640 + if (permute) {
8.641 + /* permute */
8.642 + t = in[2]; in[2] = in[6]; in[6] = in[18]; in[18] = in[10];
8.643 + in[10] = in[8]; in [8] = t;
8.644 + t = in[3]; in[3] = in[7]; in[7] = in[19]; in[19] = in[11];
8.645 + in[11] = in[9]; in [9] = t;
8.646 + t = in[4]; in[4] = in[12]; in[12] = in[14]; in[14] = in[20];
8.647 + in[20] = in[16]; in [16] = t;
8.648 + t = in[5]; in[5] = in[13]; in[13] = in[15]; in[15] = in[21];
8.649 + in[21] = in[17]; in [17] = t;
8.650 + }
8.651 +
8.652 + if (delay1) {
8.653 + /* shift through delay line 1 */
8.654 + for (j = 0; j < L1_RAW; j++) {
8.655 + if (((j/4) % MAX_L1_DEL1) != 0) {
8.656 + t = l1_delay_line1[l1_del_index % (MAX_L1_DEL1)][j];
8.657 + l1_delay_line1[l1_del_index % (MAX_L1_DEL1)][j] = in[j];
8.658 + in[j] = t;
8.659 + }
8.660 + }
8.661 + }
8.662 +
8.663 + if (in != out)
8.664 + memcpy(out, in, (L1_RAW));
8.665 +
8.666 + l1_del_index++;
8.667 + in += L1_RAW+L1_Q+L1_P;
8.668 + out += L1_RAW;
8.669 + }
8.670 + return (0);
8.671 +}
8.672 +
8.673 +static int do_decode_L2(unsigned char in[(L2_RAW+L2_Q+L2_P)],
8.674 + unsigned char out[L2_RAW]);
8.675 +
8.676 +static int do_decode_L2(unsigned char in[(L2_RAW+L2_Q+L2_P)],
8.677 + unsigned char out[L2_RAW])
8.678 +{
8.679 + return (0);
8.680 +}
8.681 +
8.682 +
8.683 +
8.684 +#define MAX_SUB_DEL 8
8.685 +static unsigned char sub_delay_line[MAX_SUB_DEL][LSUB_RAW+LSUB_Q+LSUB_P];
8.686 +static unsigned sub_del_index;
8.687 +
8.688 +/* R-W Subchannel en/decoder */
8.689 +
8.690 +int do_encode_sub(unsigned char in[LSUB_RAW*PACKETS_PER_SUBCHANNELFRAME],
8.691 + unsigned char out[(LSUB_RAW+LSUB_Q+LSUB_P)*PACKETS_PER_SUBCHANNELFRAME],
8.692 + int delay1, int permute);
8.693 +
8.694 +int do_encode_sub(unsigned char in[LSUB_RAW*PACKETS_PER_SUBCHANNELFRAME],
8.695 + unsigned char out[(LSUB_RAW+LSUB_Q+LSUB_P)*PACKETS_PER_SUBCHANNELFRAME],
8.696 + int delay1, int permute)
8.697 +{
8.698 + int i;
8.699 +
8.700 + if (in == out) return -1;
8.701 +
8.702 + for (i = 0; i < PACKETS_PER_SUBCHANNELFRAME; i++) {
8.703 + int j;
8.704 + unsigned char t;
8.705 +
8.706 + memcpy(out, in, (LSUB_RAW));
8.707 +
8.708 + /* build Q parity */
8.709 + encode_LSUB_Q(out);
8.710 +
8.711 + /* build P parity */
8.712 + encode_LSUB_P(out);
8.713 +
8.714 + if (permute) {
8.715 + /* permute */
8.716 + t = out[1]; out[1] = out[18]; out[18] = t;
8.717 + t = out[2]; out[2] = out[ 5]; out[ 5] = t;
8.718 + t = out[3]; out[3] = out[23]; out[23] = t;
8.719 + }
8.720 +
8.721 + if (delay1) {
8.722 + /* shift through delay_line */
8.723 + for (j = 0; j < LSUB_RAW+LSUB_Q+LSUB_P; j++) {
8.724 + if ((j % MAX_SUB_DEL) != 0) {
8.725 + t = sub_delay_line[(sub_del_index) % MAX_SUB_DEL][j];
8.726 + sub_delay_line[(sub_del_index + j) % MAX_SUB_DEL][j] = out[j];
8.727 + out[j] = t;
8.728 + }
8.729 + }
8.730 + }
8.731 + sub_del_index++;
8.732 + out += LSUB_RAW+LSUB_Q+LSUB_P;
8.733 + in += LSUB_RAW;
8.734 + }
8.735 + return (0);
8.736 +}
8.737 +
8.738 +int
8.739 +do_decode_sub(
8.740 + unsigned char in[(LSUB_RAW+LSUB_Q+LSUB_P)*PACKETS_PER_SUBCHANNELFRAME],
8.741 + unsigned char out[LSUB_RAW*PACKETS_PER_SUBCHANNELFRAME],
8.742 + int delay1, int permute);
8.743 +
8.744 +int
8.745 +do_decode_sub(unsigned char in[(LSUB_RAW+LSUB_Q+LSUB_P)*PACKETS_PER_SUBCHANNELFRAME],
8.746 + unsigned char out[LSUB_RAW*PACKETS_PER_SUBCHANNELFRAME],
8.747 + int delay1, int permute)
8.748 +{
8.749 + int i;
8.750 +
8.751 + if (in == out) return -1;
8.752 +
8.753 + for (i = 0; i < PACKETS_PER_SUBCHANNELFRAME; i++) {
8.754 + int j;
8.755 + unsigned char t;
8.756 +
8.757 + if (delay1) {
8.758 + /* shift through delay_line */
8.759 + for (j = 0; j < LSUB_RAW+LSUB_Q+LSUB_P; j++) {
8.760 + if ((j % MAX_SUB_DEL) != MAX_SUB_DEL-1) {
8.761 + t = sub_delay_line[(sub_del_index) % MAX_SUB_DEL][j];
8.762 + sub_delay_line[(sub_del_index + (MAX_SUB_DEL - j)) % MAX_SUB_DEL][j] = in[j];
8.763 + in[j] = t;
8.764 + }
8.765 + }
8.766 + }
8.767 +
8.768 + if (permute) {
8.769 + /* permute */
8.770 + t = in[1]; in[1] = in[18]; in[18] = t;
8.771 + t = in[2]; in[2] = in[ 5]; in[ 5] = t;
8.772 + t = in[3]; in[3] = in[23]; in[23] = t;
8.773 + }
8.774 +
8.775 + /* build P parity */
8.776 + decode_LSUB_P(in);
8.777 +
8.778 + /* build Q parity */
8.779 + decode_LSUB_Q(in);
8.780 +
8.781 + memcpy(out, in, LSUB_QRAW);
8.782 + memcpy(out+LSUB_QRAW, in+LSUB_QRAW+LSUB_Q, LSUB_RAW-LSUB_QRAW);
8.783 +
8.784 + sub_del_index++;
8.785 + in += LSUB_RAW+LSUB_Q+LSUB_P;
8.786 + out += LSUB_RAW;
8.787 + }
8.788 + return (0);
8.789 +}
8.790 +
8.791 +static int sectortype = MODE_0;
8.792 +
8.793 +int get_sector_type(void);
8.794 +
8.795 +int get_sector_type()
8.796 +{
8.797 + return (sectortype);
8.798 +}
8.799 +
8.800 +int set_sector_type(int st);
8.801 +
8.802 +int set_sector_type(int st)
8.803 +{
8.804 + switch(st) {
8.805 +
8.806 + case MODE_0:
8.807 + case MODE_1:
8.808 + case MODE_2:
8.809 + case MODE_2_FORM_1:
8.810 + case MODE_2_FORM_2:
8.811 + sectortype = st;
8.812 + return 0;
8.813 + default:
8.814 + return -1;
8.815 + }
8.816 +}
8.817 +
8.818 +/* ------------- --------------*/
8.819 +#ifdef MAIN
8.820 +
8.821 +#define DO_L1 1
8.822 +#define DO_L2 2
8.823 +#define DO_SUB 4
8.824 +
8.825 +static const unsigned sect_size[8][2] = {
8.826 +/* nothing */
8.827 +{0,0},
8.828 +/* Layer 1 decode/encode */
8.829 +{ (L1_RAW+L1_Q+L1_P)*FRAMES_PER_SECTOR, L1_RAW*FRAMES_PER_SECTOR},
8.830 +/* Layer 2 decode/encode */
8.831 +{ 16+L2_RAW+12+L2_Q+L2_P, L2_RAW},
8.832 +/* Layer 1 and 2 decode/encode */
8.833 +{ (L1_RAW+L1_Q+L1_P)*FRAMES_PER_SECTOR, L1_RAW*FRAMES_PER_SECTOR},
8.834 +/* Subchannel decode/encode */
8.835 +{ (LSUB_RAW+LSUB_Q+LSUB_P)*PACKETS_PER_SUBCHANNELFRAME,
8.836 + LSUB_RAW*PACKETS_PER_SUBCHANNELFRAME},
8.837 +/* Layer 1 and subchannel decode/encode */
8.838 +{ (L1_RAW+L1_Q+L1_P)*FRAMES_PER_SECTOR +
8.839 + (LSUB_RAW+LSUB_Q+LSUB_P)*PACKETS_PER_SUBCHANNELFRAME,
8.840 + LSUB_RAW*PACKETS_PER_SUBCHANNELFRAME +
8.841 + L1_RAW*FRAMES_PER_SECTOR},
8.842 +/* Layer 2 and subchannel decode/encode */
8.843 +{ L2_RAW+L2_Q+L2_P+
8.844 + (LSUB_RAW+LSUB_Q+LSUB_P)*PACKETS_PER_SUBCHANNELFRAME,
8.845 + LSUB_RAW*PACKETS_PER_SUBCHANNELFRAME +
8.846 + L2_RAW},
8.847 +/* Layer 1, 2 and subchannel decode/encode */
8.848 +{ (L1_RAW+L1_Q+L1_P)*FRAMES_PER_SECTOR +
8.849 + (LSUB_RAW+LSUB_Q+LSUB_P)*PACKETS_PER_SUBCHANNELFRAME,
8.850 + LSUB_RAW*PACKETS_PER_SUBCHANNELFRAME +
8.851 + L1_RAW*FRAMES_PER_SECTOR},
8.852 +};
8.853 +
8.854 +int main(int argc, char *argv[])
8.855 +{
8.856 + int encode = 1;
8.857 + int mask = DO_L2;
8.858 + FILE *infp;
8.859 + FILE *outfp;
8.860 + unsigned address = 0;
8.861 + unsigned char *l1_inbuf;
8.862 + unsigned char *l1_outbuf;
8.863 + unsigned char *l2_inbuf;
8.864 + unsigned char *l2_outbuf;
8.865 + unsigned char *sub_inbuf;
8.866 + unsigned char *sub_outbuf;
8.867 + unsigned char *last_outbuf;
8.868 + unsigned char inbuf[(LSUB_RAW+LSUB_Q+LSUB_P)*PACKETS_PER_SUBCHANNELFRAME +
8.869 + (L1_RAW+L1_Q+L1_P)*FRAMES_PER_SECTOR];
8.870 + unsigned char outbuf[(LSUB_RAW+LSUB_Q+LSUB_P)*PACKETS_PER_SUBCHANNELFRAME +
8.871 + (L1_RAW+L1_Q+L1_P)*FRAMES_PER_SECTOR];
8.872 + unsigned load_offset;
8.873 +
8.874 + l1_inbuf = l2_inbuf = sub_inbuf = inbuf;
8.875 + l1_outbuf = l2_outbuf = sub_outbuf = last_outbuf = outbuf;
8.876 +
8.877 + infp = fopen("sectors_in", "rb");
8.878 + outfp = fopen("sectors_out", "wb");
8.879 +
8.880 + sectortype= MODE_1;
8.881 + address = 0 + 75*2;
8.882 +
8.883 + switch (sectortype) {
8.884 +
8.885 + case MODE_1:
8.886 + case MODE_2:
8.887 + load_offset = 16;
8.888 + break;
8.889 + case MODE_2_FORM_1:
8.890 + case MODE_2_FORM_2:
8.891 + load_offset = 24;
8.892 + break;
8.893 + default:
8.894 + load_offset = 0;
8.895 + }
8.896 + while(1) {
8.897 +
8.898 + if (1 != fread(inbuf+load_offset,
8.899 + sect_size[mask][encode], 1, infp)) {
8.900 + perror("");
8.901 + break;
8.902 + }
8.903 + if (encode == 1) {
8.904 + if (mask & DO_L2) {
8.905 + switch (sectortype) {
8.906 +
8.907 + case MODE_0:
8.908 + break;
8.909 + case MODE_1:
8.910 + break;
8.911 + case MODE_2:
8.912 + if (1 !=
8.913 + fread(inbuf+load_offset+
8.914 + sect_size[mask][encode],
8.915 + 2336 - sect_size[mask][encode],
8.916 + 1, infp)) { perror(""); break; }
8.917 + break;
8.918 + case MODE_2_FORM_1:
8.919 + break;
8.920 + case MODE_2_FORM_2:
8.921 + if (1 !=
8.922 + fread(inbuf+load_offset+
8.923 + sect_size[mask][encode],
8.924 + 2324 - sect_size[mask][encode],
8.925 + 1, infp)) { perror(""); break; }
8.926 + break;
8.927 + default:
8.928 + if (1 !=
8.929 + fread(inbuf+load_offset+
8.930 + sect_size[mask][encode],
8.931 + 2448 - sect_size[mask][encode],
8.932 + 1, infp)) { perror(""); break; }
8.933 + memset(inbuf,0,16);
8.934 + /*memset(inbuf+16+2048,0,12+272);*/
8.935 + break;
8.936 + }
8.937 + do_encode_L2(l2_inbuf, MODE_1, address);
8.938 + if (0) scramble_L2(l2_inbuf);
8.939 + last_outbuf = l1_inbuf = l2_inbuf;
8.940 + l1_outbuf = l2_inbuf;
8.941 + sub_inbuf = l2_inbuf + L2_RAW;
8.942 + sub_outbuf = l2_outbuf + 12 + 4+ L2_RAW+4+ 8+ L2_Q+L2_P;
8.943 + }
8.944 + if (mask & DO_L1) {
8.945 + do_encode_L1(l1_inbuf, l1_outbuf,1,1,1,1);
8.946 + last_outbuf = l1_outbuf;
8.947 + sub_inbuf = l1_inbuf + L1_RAW*FRAMES_PER_SECTOR;
8.948 + sub_outbuf = l1_outbuf + (L1_RAW+L1_Q+L1_P)*FRAMES_PER_SECTOR;
8.949 + }
8.950 + if (mask & DO_SUB) {
8.951 + do_encode_sub(sub_inbuf, sub_outbuf, 0, 0);
8.952 + }
8.953 + } else {
8.954 + if (mask & DO_L1) {
8.955 + do_decode_L1(l1_inbuf, l1_outbuf,1,1,1,1);
8.956 + last_outbuf = l2_inbuf = l1_outbuf;
8.957 + l2_outbuf = l1_inbuf;
8.958 + sub_inbuf = l1_inbuf + (L1_RAW+L1_Q+L1_P)*FRAMES_PER_SECTOR;
8.959 + sub_outbuf = l1_outbuf + L1_RAW*FRAMES_PER_SECTOR;
8.960 + }
8.961 + if (mask & DO_L2) {
8.962 + do_decode_L2(l2_inbuf, l2_outbuf);
8.963 + last_outbuf = l2_outbuf;
8.964 + sub_inbuf = l2_inbuf + L2_RAW+L2_Q+L2_P;
8.965 + sub_outbuf = l2_outbuf + L2_RAW;
8.966 + }
8.967 + if (mask & DO_SUB) {
8.968 + do_decode_sub(sub_inbuf, sub_outbuf, 1, 1);
8.969 + }
8.970 + }
8.971 + if (1 != fwrite(last_outbuf, sect_size[mask][1 - encode], 1, outfp)) {
8.972 + perror("");
8.973 + break;
8.974 + }
8.975 + address++;
8.976 + }
8.977 +#if 0
8.978 + /* flush the data from the delay lines with zeroed sectors, if necessary */
8.979 +#endif
8.980 + return (0);
8.981 +}
8.982 +#endif
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
9.2 +++ b/src/gdrom/edc_encoder.h Sun Mar 02 11:38:08 2008 +0000
9.3 @@ -0,0 +1,47 @@
9.4 +/* @(#)encoder_tables 1.4 02/10/19 */
9.5 +
9.6 +/*
9.7 + * This program is free software; you can redistribute it and/or modify
9.8 + * it under the terms of the GNU General Public License version 2
9.9 + * as published by the Free Software Foundation.
9.10 + *
9.11 + * This program is distributed in the hope that it will be useful,
9.12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
9.13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9.14 + * GNU General Public License for more details.
9.15 + *
9.16 + * You should have received a copy of the GNU General Public License along with
9.17 + * this program; see the file COPYING. If not, write to the Free Software
9.18 + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
9.19 + */
9.20 +
9.21 +static const unsigned char rs_l12_alog[255] = {
9.22 + 1, 2, 4, 8,16,32,64,128,29,58,116,232,205,135,19,38,76,152,45,90,180,117,234,201,143, 3, 6,12,24,48,96,192,157,39,78,156,37,74,148,53,106,212,181,119,238,193,159,35,70,140, 5,10,20,40,80,160,93,186,105,210,185,111,222,161,95,190,97,194,153,47,94,188,101,202,137,15,30,60,120,240,253,231,211,187,107,214,177,127,254,225,223,163,91,182,113,226,217,175,67,134,17,34,68,136,13,26,52,104,208,189,103,206,129,31,62,124,248,237,199,147,59,118,236,197,151,51,102,204,133,23,46,92,184,109,218,169,79,158,33,66,132,21,42,84,168,77,154,41,82,164,85,170,73,146,57,114,228,213,183,115,230,209,191,99,198,145,63,126,252,229,215,179,123,246,241,255,227,219,171,75,150,49,98,196,149,55,110,220,165,87,174,65,130,25,50,100,200,141, 7,14,28,56,112,224,221,167,83,166,81,162,89,178,121,242,249,239,195,155,43,86,172,69,138, 9,18,36,72,144,61,122,244,245,247,243,251,235,203,139,11,22,44,88,176,125,250,233,207,131,27,54,108,216,173,71,142,};
9.23 +static const unsigned char rs_l12_log[256] = {
9.24 + 0, 0, 1,25, 2,50,26,198, 3,223,51,238,27,104,199,75, 4,100,224,14,52,141,239,129,28,193,105,248,200, 8,76,113, 5,138,101,47,225,36,15,33,53,147,142,218,240,18,130,69,29,181,194,125,106,39,249,185,201,154, 9,120,77,228,114,166, 6,191,139,98,102,221,48,253,226,152,37,179,16,145,34,136,54,208,148,206,143,150,219,189,241,210,19,92,131,56,70,64,30,66,182,163,195,72,126,110,107,58,40,84,250,133,186,61,202,94,155,159,10,21,121,43,78,212,229,172,115,243,167,87, 7,112,192,247,140,128,99,13,103,74,222,237,49,197,254,24,227,165,153,119,38,184,180,124,17,68,146,217,35,32,137,46,55,63,209,91,149,188,207,205,144,135,151,178,220,252,190,97,242,86,211,171,20,42,93,158,132,60,57,83,71,109,65,162,31,45,67,216,183,123,164,118,196,23,73,236,127,12,111,246,108,161,59,82,41,157,85,170,251,96,134,177,187,204,62,90,203,89,95,176,156,169,160,81,11,245,22,235,122,117,44,215,79,174,213,233,230,231,173,232,116,214,244,234,168,80,88,175,};
9.25 +static const unsigned char rs_sub_rw_alog[63] = {
9.26 + 1, 2, 4, 8,16,32, 3, 6,12,24,48,35, 5,10,20,40,19,38,15,30,60,59,53,41,17,34, 7,14,28,56,51,37, 9,18,36,11,22,44,27,54,47,29,58,55,45,25,50,39,13,26,52,43,21,42,23,46,31,62,63,61,57,49,33,};
9.27 +static const unsigned char rs_sub_rw_log[63] = {
9.28 + 0, 0, 1, 6, 2,12, 7,26, 3,32,13,35, 8,48,27,18, 4,24,33,16,14,52,36,54, 9,45,49,38,28,41,19,56, 5,62,25,11,34,31,17,47,15,23,53,51,37,44,55,40,10,61,46,30,50,22,39,43,29,60,42,21,20,59,57,};
9.29 +static const unsigned char SQ[2][2] = {
9.30 +{26,6,},
9.31 +{7,1,},
9.32 +};
9.33 +static const unsigned char SP[4][20] = {
9.34 +{57,38,44,29,17,57,53,58,60,39,12,38,18,41,6,25,39,37,5,18,},
9.35 +{38,62,42,13,30,11,46,5,54,26,12,49,48,46,8,50,28,9,12,39,},
9.36 +{32,18,41,49,52,62,38,36,39,58,37,24,34,51,51,27,28,36,22,21,},
9.37 +{44,50,35,23,0,59,1,3,45,18,44,24,47,12,31,45,43,11,24,6,},
9.38 +};
9.39 +static const unsigned char AQ[4][24] = {
9.40 +{58,152,173,95,88,43,134,205,143,131,163,75,37,109,194,159,168,227,153,59,101,},
9.41 +{30,214,148,138,112,154,157,96,49,198,189,249,83,23,70,237,70,41,47,52,125,247,},
9.42 +{162,244,13,171,213,236,71,177,253,162,59,78,46,68,238,112,147,197,115,200,117,15,236,},
9.43 +{158,179,101,94,49,140,211,149,137,169,81,6,33,30,27,24,21,18,15,12,9,6,3,0,},
9.44 +};
9.45 +static const unsigned char AP[4][32] = {
9.46 +{140,143,52,103,249,142,180,197,5,155,153,132,143,244,101,76,102,155,203,104,58,152,173,95,88,43,134,205,143,131,163,75,},
9.47 +{104,97,17,162,205,252,218,199,202,41,136,106,119,238,193,103,123,242,83,178,30,214,148,138,112,154,157,96,49,198,189,249,},
9.48 +{240,119,29,185,67,11,131,40,7,41,80,147,151,17,245,253,208,66,228,116,162,244,13,171,213,236,71,177,253,162,59,78,},
9.49 +{149,58,109,0,148,186,203,11,161,159,138,149,250,107,82,108,161,209,110,64,158,179,101,94,49,140,211,149,137,169,81,6,},
9.50 +};
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
10.2 +++ b/src/gdrom/edc_l2sq.h Sun Mar 02 11:38:08 2008 +0000
10.3 @@ -0,0 +1,1180 @@
10.4 +/* @(#)l2sq_table 1.2 02/10/19 Copyright 2002 J. Schilling */
10.5 +
10.6 +/*
10.7 + * This program is free software; you can redistribute it and/or modify
10.8 + * it under the terms of the GNU General Public License version 2
10.9 + * as published by the Free Software Foundation.
10.10 + *
10.11 + * This program is distributed in the hope that it will be useful,
10.12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
10.13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10.14 + * GNU General Public License for more details.
10.15 + *
10.16 + * You should have received a copy of the GNU General Public License along with
10.17 + * this program; see the file COPYING. If not, write to the Free Software
10.18 + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
10.19 + */
10.20 +
10.21 +static const unsigned short L2sq[43][256] = {
10.22 +{0,44719,16707,61420,33414,11305,50117,28010,6417,47038,
10.23 + 22610,63229,39831,13624,56020,29819,12834,40077,29537,56782,
10.24 + 45220,7691,61927,24392,11059,34204,27248,50399,43445,1818,
10.25 + 59638,18009,25668,51947,9479,35752,59074,18541,42881,2350,
10.26 + 32085,54266,15382,37561,65491,20860,48784,4159,22118,63689,
10.27 + 5925,47498,54496,31311,38307,15116,20343,57816,3636,41115,
10.28 + 52721,25438,36018,8733,51336,26151,35275,10084,18958,58529,
10.29 + 2893,42466,53657,32566,37082,15989,21279,64944,4700,48371,
10.30 + 64170,21509,48105,5446,30764,54915,14703,38848,58299,19732,
10.31 + 41720,3159,24893,53138,8318,36561,44236,611,60815,17184,
10.32 + 11850,32997,28425,49574,46557,7026,62622,23089,14171,39412,
10.33 + 30232,55479,40686,12353,57261,28930,7272,45767,23851,62340,
10.34 + 34815,10576,50876,26643,1401,43990,17466,60053,36109,9122,
10.35 + 52302,25313,3979,41252,20168,57447,37916,15027,54623,31728,
10.36 + 5786,47157,22489,63862,48943,4480,65132,20675,15785,37638,
10.37 + 31978,53829,42558,2193,59261,18898,9400,35351,26107,52052,
10.38 + 59721,18406,43018,1701,27599,50528,10892,33827,61528,24311,
10.39 + 45339,8116,29406,56433,13213,40242,56171,30148,39464,13447,
10.40 + 23021,63298,6318,46593,49786,27861,33593,11670,16636,61011,
10.41 + 447,44816,17797,60202,1222,43625,50947,27052,34368,10479,
10.42 + 23700,62011,7639,45944,56850,28861,40785,12798,30631,55560,
10.43 + 14052,38987,62753,23438,46178,6861,28342,49177,12277,33114,
10.44 + 60464,17055,44403,988,8641,36718,24706,52781,41799,3560,
10.45 + 57860,19627,14544,38527,31123,55100,47702,5369,64277,21946,
10.46 + 5091,48460,21152,64527,37221,16330,53286,32393,2802,42077,
10.47 + 19377,58654,34932,9947,51511,26520,
10.48 +},
10.49 +{0,55768,44973,30325,17223,39583,60650,13618,34446,24406,
10.50 + 10531,61691,50633,7185,27236,46012,4353,51417,48812,26484,
10.51 + 21062,35742,65003,9267,38799,20055,14370,57850,54472,3344,
10.52 + 31589,41661,8706,64474,36271,21623,24901,47261,52968,5936,
10.53 + 42124,32084,2849,54009,59339,15891,18534,37310,13059,60123,
10.54 + 40110,17782,28740,43420,57321,1585,46477,27733,6688,50168,
10.55 + 63178,12050,22887,32959,17412,40412,60329,12913,1859,56987,
10.56 + 43246,28982,49802,6994,27943,46335,33229,22549,11872,63416,
10.57 + 21765,36061,64168,9072,5698,53146,47599,24631,54155,2643,
10.58 + 31782,42494,37068,18708,16225,59065,26118,49118,51627,4211,
10.59 + 9537,64665,35564,21300,57480,14672,20261,38653,41935,31255,
10.60 + 3170,54714,30471,44767,55466,370,13376,60824,39917,16949,
10.61 + 61833,10321,24100,34812,45774,27414,7523,50363,34824,20944,
10.62 + 10149,65149,52047,4759,25826,48442,3718,55134,41259,30963,
10.63 + 19905,37913,57964,15284,39177,16593,13988,61308,55886,918,
10.64 + 30179,44091,8071,50783,45098,27122,23744,34072,62317,10933,
10.65 + 43530,29650,1447,56447,59725,12437,18144,40760,11396,62812,
10.66 + 33577,23281,28611,46619,49262,6582,47883,25299,5286,52606,
10.67 + 63564,8596,22497,36409,15749,58461,37416,19440,32450,42778,
10.68 + 53615,2231,52236,5588,25505,47737,36683,22163,8422,63806,
10.69 + 19074,37722,58671,15607,2501,53277,42600,32688,56589,1237,
10.70 + 29344,43896,40522,18322,12775,59455,23427,33371,62510,11766,
10.71 + 6340,49436,46953,28337,60942,14294,16803,39035,44361,29841,
10.72 + 740,56124,26752,45400,50989,7925,11207,61983,33898,23986,
10.73 + 65295,9943,20642,35194,48200,26000,5093,51773,31105,41049,
10.74 + 54828,4084,15046,58142,38251,19635,
10.75 +},
10.76 +{0,27757,55514,46263,44457,49604,30067,6430,18255,11042,
10.77 + 40853,62456,60134,34443,12860,24145,36510,58099,22084,14889,
10.78 + 9015,20314,64493,38784,51665,42428,4363,32102,25720,2069,
10.79 + 48290,53455,289,27980,55803,46486,44168,49381,29778,6207,
10.80 + 18030,10755,40628,62169,60359,34730,13085,24432,36799,58322,
10.81 + 22373,15112,8726,20091,64204,38561,51440,42141,4138,31815,
10.82 + 25945,2356,48515,53742,578,28207,55960,46837,45035,50054,
10.83 + 30513,7004,17677,10592,40407,61882,59556,33993,12414,23571,
10.84 + 36060,57521,21510,14443,8565,19736,63919,38338,52115,43006,
10.85 + 4937,32548,26170,2647,48864,53901,867,28430,56249,47060,
10.86 + 44746,49831,30224,6781,17452,10305,40182,61595,59781,34280,
10.87 + 12639,23858,36349,57744,21799,14666,8276,19513,63630,38115,
10.88 + 51890,42719,4712,32261,26395,2934,49089,54188,1156,26857,
10.89 + 56414,45107,43309,50496,29175,7578,17355,12198,39697,63356,
10.90 + 61026,33295,14008,23253,35354,58999,21184,16045,10163,19422,
10.91 + 65385,37636,52565,41272,5519,31202,24828,3217,47142,54347,
10.92 + 1445,27080,56703,45330,43020,50273,28886,7355,17130,11911,
10.93 + 39472,63069,61251,33582,14233,23540,35643,59222,21473,16268,
10.94 + 9874,19199,65096,37413,52340,40985,5294,30915,25053,3504,
10.95 + 47367,54634,1734,27307,56860,45681,43887,50946,29621,8152,
10.96 + 16777,11748,39251,62782,60448,32845,13562,22679,34904,58421,
10.97 + 20610,15599,9713,18844,64811,37190,53015,41850,6093,31648,
10.98 + 25278,3795,47716,54793,2023,27530,57149,45904,43598,50723,
10.99 + 29332,7929,16552,11461,39026,62495,60673,33132,13787,22966,
10.100 + 35193,58644,20899,15822,9424,18621,64522,36967,52790,41563,
10.101 + 5868,31361,25503,4082,47941,55080,
10.102 +},
10.103 +{0,47289,28015,54742,56030,25191,47025,3848,43425,4376,
10.104 + 50382,31863,29567,52166,7696,42665,20319,63462,8752,39561,
10.105 + 38273,11576,63726,16471,59134,24135,35729,13096,15392,33945,
10.106 + 20815,59894,40638,9735,62417,19304,17504,64729,10511,37302,
10.107 + 14111,36774,23152,58057,60865,21880,32942,14359,53729,26968,
10.108 + 48270,1079,2879,45958,26192,57065,30784,49401,5423,44438,
10.109 + 41630,6695,53233,30536,8545,39384,19470,62647,64447,17158,
10.110 + 38608,11881,35008,12409,58799,23830,21022,60071,16241,34760,
10.111 + 28222,54919,849,48104,46304,3161,55695,24886,51103,32550,
10.112 + 43760,4681,7489,42488,28718,51351,49119,1894,53936,27145,
10.113 + 25857,56760,2158,45271,5758,44743,31505,50088,52384,29721,
10.114 + 41423,6518,61568,18489,40431,9558,10846,37607,18225,65416,
10.115 + 22817,57752,13390,36087,33791,15174,61072,22057,17090,64123,
10.116 + 12205,38676,38940,8357,62835,19914,60259,21466,34316,16053,
10.117 + 12733,35076,23762,58475,3485,46372,24818,55371,55107,28666,
10.118 + 47660,661,42044,7301,51539,29162,32482,50779,5005,43828,
10.119 + 56444,25797,45331,2474,1698,48667,27597,54132,30173,52580,
10.120 + 6322,40971,44803,6074,49772,31445,37667,11162,65100,18165,
10.121 + 18941,61764,9362,39979,14978,33339,22509,61268,57436,22757,
10.122 + 36147,13706,25507,56090,3788,46709,47485,452,54290,27819,
10.123 + 51714,29371,42861,8148,4316,43109,32179,50442,11516,37957,
10.124 + 16787,63786,63010,20123,39757,9204,34141,15844,59442,20619,
10.125 + 24451,59194,13036,35413,64797,17828,36978,10443,10179,40826,
10.126 + 19116,61973,21692,60421,14803,33130,36450,14043,58125,23476,
10.127 + 45634,2811,57133,26516,26780,53285,1523,48458,7139,41818,
10.128 + 30348,52789,49469,31108,44114,5355,
10.129 +},
10.130 +{0,53971,47547,27496,28523,48568,54992,1027,57046,3077,
10.131 + 26477,46526,45501,25454,2054,56021,41393,29538,6154,51929,
10.132 + 52954,7177,30561,42418,32615,44468,50908,5135,4108,49887,
10.133 + 43447,31588,24447,36268,59076,13335,12308,58055,35247,23420,
10.134 + 33193,21370,14354,60097,61122,15377,22393,34218,65230,11293,
10.135 + 18293,38310,37285,17270,10270,64205,8216,62155,39331,19312,
10.136 + 20339,40352,63176,9243,48894,27693,1861,54678,53653,838,
10.137 + 26670,47869,24616,45819,55699,2880,3907,56720,46840,25643,
10.138 + 8015,52636,42740,29735,28708,41719,51615,6988,49561,4938,
10.139 + 30754,43761,44786,31777,5961,50586,57729,13138,22586,35561,
10.140 + 36586,23609,14161,58754,16215,60804,34540,21567,20540,33519,
10.141 + 59783,15188,16432,37603,63883,11096,12123,64904,38624,17459,
10.142 + 40678,19509,10077,62862,61837,9054,18486,39653,25057,45874,
10.143 + 55386,2697,3722,56409,46897,26082,48951,28132,1676,54367,
10.144 + 53340,655,27111,47924,49232,4739,31211,43832,44859,32232,
10.145 + 5760,50259,7814,52309,42813,30190,29165,41790,51286,6789,
10.146 + 16030,60493,34597,22006,20981,33574,59470,15005,57416,12955,
10.147 + 23027,35616,36643,24048,13976,58443,40751,19964,9876,62535,
10.148 + 61508,8855,18943,39724,16889,37674,63554,10897,11922,64577,
10.149 + 38697,17914,57119,3532,26276,46199,45172,25255,2511,56092,
10.150 + 457,54042,47218,27297,28322,48241,55065,1482,32430,44157,
10.151 + 50965,5574,4549,49942,43134,31405,41080,29355,6595,51984,
10.152 + 53011,7616,30376,42107,32864,21171,14811,60168,61195,15832,
10.153 + 22192,33891,24246,35941,59149,13790,12765,58126,34918,23221,
10.154 + 8657,62210,39018,19129,20154,40041,63233,9682,65287,11732,
10.155 + 18108,37999,36972,17087,10711,64260,
10.156 +},
10.157 +{0,59366,54225,13367,48063,23641,26734,36744,27491,35973,
10.158 + 47282,24404,53468,14138,781,58603,54982,12576,1303,58097,
10.159 + 28025,35487,48808,22862,48549,23107,28276,35218,1562,57852,
10.160 + 54731,12845,45457,22135,25152,34214,2606,60872,55807,15897,
10.161 + 56050,15636,2339,61125,24909,34475,45724,21882,26455,32945,
10.162 + 46214,21344,56552,15118,3897,59615,3124,60370,57317,14339,
10.163 + 46987,20589,25690,33724,32575,39129,44270,19208,50304,9062,
10.164 + 5969,61623,5212,62394,51085,8299,45027,18437,31794,39892,
10.165 + 43513,19999,31272,40398,4678,62880,49559,9841,49818,9596,
10.166 + 4427,63149,31013,40643,43764,19730,52910,10568,7551,64153,
10.167 + 29969,37623,42688,16678,42445,16939,30236,37370,7794,63892,
10.168 + 52643,10821,6248,65422,52153,11359,41943,17457,28678,38880,
10.169 + 29451,38125,41178,18236,51380,12114,7013,64643,65150,6552,
10.170 + 11695,51785,17857,41511,38416,29174,38173,29435,18124,41258,
10.171 + 11938,51524,64883,6805,10424,53086,64361,7311,37639,29921,
10.172 + 16598,42800,17371,42045,36874,30700,63588,8066,11189,52307,
10.173 + 20463,43017,39998,31704,62544,5046,10113,49255,9356,50026,
10.174 + 63325,4283,40755,30933,19682,43780,39209,32463,19192,44318,
10.175 + 8854,50544,61767,5793,62026,5548,8603,50813,18933,44563,
10.176 + 39460,32194,33089,26279,21136,46454,15102,56600,59695,3785,
10.177 + 59938,3524,14835,56853,20893,46715,33356,26026,22407,45153,
10.178 + 33878,25520,60472,3038,16361,55311,15588,56066,61237,2259,
10.179 + 34651,24765,21642,45932,12496,55094,58113,1255,35695,27785,
10.180 + 22718,48984,23475,48213,34914,28548,57356,2026,13277,54331,
10.181 + 58902,496,13767,53793,23977,47695,36472,27038,36213,27283,
10.182 + 24228,47426,14026,53548,58651,765,
10.183 +},
10.184 +{0,29554,59108,38294,53717,41639,14129,17475,49079,52421,
10.185 + 22867,10785,28258,7440,34950,64500,25459,4097,34199,63205,
10.186 + 45734,49620,21570,10032,56516,44982,14880,18770,3345,32355,
10.187 + 60405,39047,50918,46484,8194,21360,5939,25665,61911,33445,
10.188 + 31057,2595,40885,60615,43140,56310,20064,15634,42389,55015,
10.189 + 17265,12291,29760,1842,37540,57814,6690,26960,64710,36788,
10.190 + 52215,47237,11539,24161,37329,58019,30517,1095,16388,13174,
10.191 + 42720,54674,11878,23828,51330,48112,65459,36033,6487,27173,
10.192 + 62114,33232,5190,26420,9079,20485,50579,46817,19733,15975,
10.193 + 44017,55427,40128,61362,31268,2390,22327,9285,45523,49825,
10.194 + 34530,62864,24582,4980,59520,39922,3684,32022,14677,18983,
10.195 + 57265,44227,13380,18230,53920,41426,58769,38627,885,28679,
10.196 + 35827,63617,27927,7781,23078,10580,48322,53168,16319,19661,
10.197 + 55643,43561,61034,40216,2190,31740,32776,62330,26348,5534,
10.198 + 20957,8879,46905,50251,23756,12222,47656,51546,36121,65131,
10.199 + 27645,6287,58235,36873,1439,30445,12974,16860,54346,42808,
10.200 + 63833,35371,8125,27855,10380,23550,52840,48410,18158,13724,
10.201 + 40970,54136,38715,58441,29151,685,39466,59736,31950,4028,
10.202 + 19455,14477,44315,56937,9629,22255,50041,45067,62536,34618,
10.203 + 4780,25054,44654,56604,18570,15352,32699,3273,39263,59949,
10.204 + 4569,25259,63293,33871,49164,45950,9960,21914,52509,48751,
10.205 + 11257,22667,7368,28602,64044,35166,29354,472,37966,59196,
10.206 + 41855,53261,17819,14057,26760,7162,36460,64798,47453,51759,
10.207 + 24505,11467,55103,42061,12763,17065,1770,30104,57358,37756,
10.208 + 3067,30857,60703,40557,55854,43356,15562,20408,46156,51006,
10.209 + 21160,8666,26009,5867,33661,61455,
10.210 +},
10.211 +{0,14648,29296,19272,58592,56792,38544,44968,54749,60645,
10.212 + 42925,40597,12605,2053,17229,31349,47015,36511,50647,64751,
10.213 + 21319,27263,8503,6159,25210,23362,4106,10546,34458,49058,
10.214 + 62698,52690,29523,19051,291,14363,38835,44683,58819,56571,
10.215 + 42638,40886,54526,60870,17006,31574,12318,2342,50420,64972,
10.216 + 46724,36796,8212,6444,21092,27484,4393,10257,25433,23137,
10.217 + 62921,52465,34745,48769,59046,57246,38102,44526,582,15230,
10.218 + 28726,18702,13179,2627,16651,30771,55195,61091,42475,40147,
10.219 + 20737,26681,9073,6729,46561,36057,51089,65193,34012,48612,
10.220 + 63148,53140,24636,22788,4684,11124,38389,44237,59269,57021,
10.221 + 28949,18477,869,14941,16424,30992,12888,2912,42184,40432,
10.222 + 54968,61312,8786,7018,20514,26906,50866,65418,46274,36346,
10.223 + 63375,52919,34303,48327,4975,10839,24863,22567,53585,59497,
10.224 + 41761,39449,13745,3209,18369,32505,1164,15796,30460,20420,
10.225 + 57452,55636,37404,43812,26358,24526,5254,11710,33302,47918,
10.226 + 61542,51550,45867,35347,49499,63587,22475,28403,9659,7299,
10.227 + 41474,39738,53362,59722,18146,32730,13458,3498,30687,20199,
10.228 + 1455,15511,37695,43527,57679,55415,5541,11421,26581,24301,
10.229 + 61765,51325,33589,47629,49272,63808,45576,35632,9368,7584,
10.230 + 22248,28624,14327,3791,17799,31935,54039,59951,41319,39007,
10.231 + 57898,56082,36954,43362,1738,16370,29882,19842,32848,47464,
10.232 + 61984,51992,25776,23944,5824,12280,21901,27829,10237,7877,
10.233 + 45421,34901,49949,64037,17572,32156,14036,4076,41028,39292,
10.234 + 53812,60172,37241,43073,58121,55857,30105,19617,2025,16081,
10.235 + 62211,51771,33139,47179,6115,11995,26003,23723,9950,8166,
10.236 + 21678,28054,49726,64262,45134,35190,
10.237 +},
10.238 +{0,7197,14394,9255,28788,27753,18510,21587,57576,64757,
10.239 + 55506,50383,37020,35969,43174,46267,56781,49616,58871,63978,
10.240 + 44473,45476,38275,35230,15653,8504,1311,6402,19793,20812,
10.241 + 30059,26998,42887,48026,40893,33696,55283,52206,61385,62420,
10.242 + 18287,23410,32597,25416,14107,11014,3873,4924,31306,26199,
10.243 + 17008,24173,2622,5667,12804,11801,39586,34495,41624,48773,
10.244 + 60118,63179,53996,52977,21267,20238,27433,30516,9063,16250,
10.245 + 7005,1856,46075,45030,35777,38876,50063,57234,64437,59304,
10.246 + 36574,37571,46820,43769,65194,58039,50832,55949,28214,29227,
10.247 + 22028,18961,7746,607,9848,14949,62612,59529,52398,53427,
10.248 + 34016,39165,48346,41159,5244,2145,11334,12379,25608,30741,
10.249 + 23602,16431,10585,13636,4451,3454,22829,17712,24855,32010,
10.250 + 51633,54700,61835,60822,47557,42456,33279,40418,42534,47675,
10.251 + 40476,33281,54866,51791,61032,62069,18126,23251,32500,25321,
10.252 + 14010,10919,3712,4765,31723,26614,17361,24524,2975,6018,
10.253 + 13221,12216,39683,34590,41785,48932,60279,63338,54093,53072,
10.254 + 417,7612,14747,9606,29141,28104,18927,22002,57673,64852,
10.255 + 55667,50542,37181,36128,43271,46362,56428,49265,58454,63563,
10.256 + 44056,45061,37922,34879,15492,8345,1214,6307,19696,20717,
10.257 + 29898,26839,62773,59688,52495,53522,34113,39260,48507,41318,
10.258 + 5597,2496,11751,12794,26025,31156,23955,16782,10488,13541,
10.259 + 4290,3295,22668,17553,24758,31915,51216,54285,61482,60471,
10.260 + 47204,42105,32862,40003,21170,20143,27272,30357,8902,16091,
10.261 + 6908,1761,45658,44615,35424,38525,49710,56883,64020,58889,
10.262 + 36735,37730,46917,43864,65291,58134,50993,56108,28567,29578,
10.263 + 22445,19376,8163,1022,10201,15300,
10.264 +},
10.265 +{0,32897,7455,40350,14910,47807,10017,42912,29820,62717,
10.266 + 26979,59874,20034,52931,21341,54236,59640,26745,62951,30054,
10.267 + 53958,21063,53209,20312,40068,7173,33179,282,42682,9787,
10.268 + 48037,15140,52717,19820,53490,20595,63443,30546,60108,27213,
10.269 + 47505,14608,42126,9231,33711,814,40624,7729,9493,42388,
10.270 + 14346,47243,7979,40874,564,33461,20841,53736,19574,52471,
10.271 + 27479,60374,30280,63177,34759,1862,39640,6745,48633,15736,
10.272 + 41190,8295,62395,29498,61092,28197,51589,18692,54426,21531,
10.273 + 28479,61374,29216,62113,21761,54656,18462,51359,6979,39874,
10.274 + 1628,34525,8573,41468,15458,48355,18986,51883,22325,55220,
10.275 + 28692,61589,27915,60810,15958,48855,9033,41928,1128,34025,
10.276 + 6519,39414,41682,8787,49101,16204,39148,6253,34291,1394,
10.277 + 54958,22063,52145,19248,60560,27665,61839,28942,5011,37650,
10.278 + 3724,36365,10669,43308,13490,46131,26607,59246,31472,64113,
10.279 + 24017,56656,16590,49231,64363,31722,58996,26357,49493,16852,
10.280 + 56394,23755,36631,3990,37384,4745,46377,13736,43062,10423,
10.281 + 56958,24319,50017,17376,58432,25793,63839,31198,43522,10883,
10.282 + 46877,14236,36924,4285,36131,3490,13958,46599,11161,43800,
10.283 + 3256,35897,4519,37158,17146,49787,24549,57188,30916,63557,
10.284 + 26075,58714,37972,5333,35147,2506,44650,12011,45941,13300,
10.285 + 57384,24745,64823,32182,55830,23191,50953,18312,31916,64557,
10.286 + 25011,57650,18066,50707,23437,56076,2256,34897,5583,38222,
10.287 + 13038,45679,12273,44912,22969,55608,17574,50215,25479,58118,
10.288 + 32408,65049,11717,44356,12506,45147,6139,38778,2788,35429,
10.289 + 45377,12736,44126,11487,35711,3070,38496,5857,50493,17852,
10.290 + 55330,22691,65283,32642,57884,25245,
10.291 +},
10.292 +{0,52943,33155,20300,7963,53716,40600,20567,15926,61689,
10.293 + 49077,29050,8493,61410,41134,28257,31852,45731,65007,13088,
10.294 + 25463,44472,58100,11323,16986,35989,50137,3350,23873,37774,
10.295 + 56514,4621,63704,13847,31067,46996,59331,10508,26176,43151,
10.296 + 50926,2081,18285,35234,55797,5946,22646,38585,33972,19067,
10.297 + 1335,52216,39855,21856,6700,54499,47746,29773,15105,62926,
10.298 + 42393,27478,9242,60117,60845,9058,27694,41697,62134,15481,
10.299 + 29493,48634,54171,7508,21016,40151,52352,591,19715,33740,
10.300 + 37313,24334,4162,56973,36570,16405,3929,49558,45047,24888,
10.301 + 11892,57531,45292,32291,12655,65440,5493,56250,38134,23097,
10.302 + 2670,50337,35821,17698,11075,58764,43712,25615,13400,64151,
10.303 + 46555,31508,26905,42966,59546,9813,30210,47309,63361,14670,
10.304 + 22319,39392,54956,6243,18484,34555,51639,1912,51015,2440,
10.305 + 18116,34827,55388,5779,23007,38672,63857,14270,30962,46653,
10.306 + 58986,10405,26601,43302,47915,30180,15016,62567,42032,27391,
10.307 + 9651,60284,34077,19410,1182,51793,39430,21705,7045,54602,
10.308 + 16287,61776,48668,28883,8324,61003,41223,28616,425,53094,
10.309 + 32810,20197,7858,53373,40753,20990,17395,36156,49776,3263,
10.310 + 23784,37415,56683,5028,32197,45834,64582,12937,25310,44049,
10.311 + 58205,11666,10986,58405,43881,26022,13809,64318,46194,31421,
10.312 + 5340,55827,38239,23440,3015,50440,35396,17547,22150,38985,
10.313 + 55045,6602,18845,34642,51230,1745,26800,42623,59699,10236,
10.314 + 30635,47460,63016,14567,53810,7421,21425,40318,52521,998,
10.315 + 19626,33381,60420,8907,28039,41800,62239,15824,29340,48211,
10.316 + 44638,24721,12253,57618,45381,32650,12486,65033,36968,24231,
10.317 + 4587,57124,36723,16828,3824,49215,
10.318 +},
10.319 +{0,59880,53197,9765,33671,27247,19530,42402,6931,62203,
10.320 + 54494,15670,39060,29052,22361,48817,13862,57294,63979,4099,
10.321 + 46497,23625,31340,37764,11573,50397,58104,2832,44722,18266,
10.322 + 24959,34967,27724,34212,41857,19049,61387,1571,8198,51694,
10.323 + 30559,40631,47250,20858,62680,7472,15125,54013,23146,45954,
10.324 + 38311,31823,55789,12293,5664,65480,16761,43153,36532,26460,
10.325 + 49918,11030,3379,58587,55448,12656,5973,65213,23327,45815,
10.326 + 38098,32058,50059,10851,3142,58798,16396,43492,36801,26153,
10.327 + 61118,1878,8563,51355,27961,34001,41716,19228,62893,7237,
10.328 + 14944,54152,30250,40898,47591,20495,46292,23868,31513,37617,
10.329 + 14163,57019,63646,4470,44999,17967,24586,35298,11328,50600,
10.330 + 58253,2661,33522,27418,19775,42199,373,59549,52920,10064,
10.331 + 39393,28681,22060,49092,6758,62350,54699,15427,44333,17605,
10.332 + 25312,35592,11946,51010,57703,2191,46654,24534,31219,36891,
10.333 + 13753,56401,64116,5020,39691,29411,21702,48430,6284,61796,
10.334 + 55105,16041,32792,27120,20437,42557,927,60023,52306,9658,
10.335 + 49505,10377,3756,59204,17126,43790,36139,25795,55922,13210,
10.336 + 5567,64599,23029,45085,38456,32720,63303,7855,14474,53602,
10.337 + 29888,40232,47885,21221,60500,1468,9113,51825,28627,34363,
10.338 + 40990,18934,30133,40029,47736,21392,63026,8154,14847,53271,
10.339 + 28326,34638,41323,18563,60705,1225,8940,51972,17299,43643,
10.340 + 35934,26038,49172,10748,4057,58929,22656,45416,38733,32421,
10.341 + 56071,13039,5322,64802,6649,61457,54836,16348,39550,29590,
10.342 + 21939,48219,746,60162,52519,9423,33133,26757,20128,42824,
10.343 + 12255,50743,57362,2554,44120,17840,25493,35453,13516,56612,
10.344 + 64257,4841,46923,24227,30854,37230,
10.345 +},
10.346 +{0,29813,59626,40095,52681,47548,9507,20822,34703,62458,
10.347 + 28517,6928,19014,15923,41644,55001,4867,26486,64489,36764,
10.348 + 57034,43711,13856,16981,38028,57593,31846,2067,22853,11568,
10.349 + 45487,50650,9734,21107,52972,47769,60367,40890,805,30544,
10.350 + 41353,54780,18787,15638,27712,6197,33962,61663,13573,16752,
10.351 + 56815,43418,63692,36025,4134,25683,45706,50943,23136,11797,
10.352 + 32579,2870,38825,58332,19468,14457,42214,53395,33221,62896,
10.353 + 26927,7514,52099,49142,9065,22300,1610,29247,61088,39637,
10.354 + 24335,11130,47077,50064,37574,59059,31276,3673,55424,44277,
10.355 + 12394,17439,5449,24892,64931,35286,27146,7807,33504,63125,
10.356 + 42947,54198,20265,15196,60805,39408,1391,28954,8268,21561,
10.357 + 51366,48339,30985,3452,37347,58774,46272,49333,23594,10335,
10.358 + 65158,35571,5740,25113,13135,18234,56229,45008,38936,60525,
10.359 + 28914,1159,21969,8612,48443,51534,8087,27618,63357,33544,
10.360 + 53854,42539,15028,20161,35611,65390,25585,6020,18130,12967,
10.361 + 44600,55885,3220,30945,58494,36875,49501,46376,10679,24002,
10.362 + 48670,51819,22260,8833,29655,1954,39741,61256,14737,19940,
10.363 + 53627,42254,62552,32813,7346,26823,44317,55656,17911,12674,
10.364 + 24788,5281,34878,64587,10898,24295,49784,46605,59227,37678,
10.365 + 4017,31684,54292,41057,15614,18571,6621,28072,61751,34114,
10.366 + 21403,10222,47985,52996,40530,59943,30392,717,50967,45922,
10.367 + 12285,23432,2782,32427,57908,38465,16536,13549,43122,56327,
10.368 + 36177,63780,26043,4558,61970,34407,6904,28301,16347,19374,
10.369 + 55089,41796,30109,488,40311,59650,47188,52257,20670,9419,
10.370 + 57617,38244,2555,32142,11480,22701,50226,45127,26270,4843,
10.371 + 36468,64001,43863,57122,17341,14280,
10.372 +},
10.373 +{0,46261,30071,49602,60142,24155,40857,11052,51649,32116,
10.374 + 48310,2051,9007,38810,22104,58093,36767,15146,64232,20061,
10.375 + 25969,53700,4102,42163,18014,62187,13097,34716,44208,6149,
10.376 + 55751,28018,803,46998,30292,49889,59853,23928,40122,10255,
10.377 + 51938,32343,49045,2848,8204,38073,21883,57806,36028,14345,
10.378 + 63947,19838,26194,53991,4901,42896,17789,61896,12298,33983,
10.379 + 44947,6950,56036,28241,1606,45811,29489,51076,60584,22557,
10.380 + 39391,11626,53127,31538,47856,3653,9577,37340,20510,58539,
10.381 + 35289,15724,64686,18459,25399,55170,5696,41717,16408,62637,
10.382 + 13679,33242,43766,7747,57217,27444,1381,45520,28690,50343,
10.383 + 61323,23358,39676,11849,52388,30737,47571,3430,9802,37631,
10.384 + 21309,59272,35578,15951,65421,19256,24596,54433,5475,41430,
10.385 + 17211,63374,13900,33529,43477,7520,56482,26647,3212,47161,
10.386 + 31227,52558,58978,21207,37653,10144,50509,29176,45114,1167,
10.387 + 12195,39702,23252,61025,33555,14246,63076,17105,27133,56648,
10.388 + 7306,43071,19154,65127,16293,35600,41020,5257,54603,25086,
10.389 + 4015,47898,31448,52845,58689,20980,36918,9347,50798,29403,
10.390 + 45849,1964,11392,38965,23031,60738,32816,13445,62791,16882,
10.391 + 27358,56939,8105,43804,18929,64836,15494,34867,41759,6058,
10.392 + 54888,25309,2762,48767,32701,51976,57380,21649,38227,8678,
10.393 + 49931,30654,46716,713,10725,40272,23698,59431,34133,12768,
10.394 + 61474,17559,28603,56078,6860,44665,19604,63521,14819,36182,
10.395 + 42618,4815,54029,26552,2537,48476,31902,51243,58119,22450,
10.396 + 38512,8901,49192,29853,46431,490,10950,40563,24497,60164,
10.397 + 34422,12995,62209,18356,27800,55341,6639,44378,20407,64258,
10.398 + 15040,36469,42329,4588,53294,25755,
10.399 +},
10.400 +{0,54485,46519,24930,30579,41894,49860,5649,61158,14899,
10.401 + 23377,36740,39317,19776,11298,63735,49617,5380,29798,41139,
10.402 + 46754,25207,789,55232,12087,64482,39552,20053,22596,35985,
10.403 + 60915,14630,40895,19306,10760,65245,59596,15385,23931,35246,
10.404 + 29017,42380,50414,4155,1578,54015,45981,26440,24174,35515,
10.405 + 60377,16140,10525,64968,40106,18559,45192,25693,1343,53738,
10.406 + 51195,4910,29260,42649,9059,63414,38612,16897,21520,32965,
10.407 + 57767,13682,52613,6480,30770,44263,47862,28195,3905,56212,
10.408 + 58034,13927,22277,33744,38337,16660,8310,62627,3156,55425,
10.409 + 47587,27958,31527,45042,52880,6725,48348,26633,2411,56766,
10.410 + 52143,8058,32280,43725,21050,34543,59277,13144,9545,61852,
10.411 + 37118,17451,32013,43480,51386,7279,2686,57003,49097,27420,
10.412 + 37867,18238,9820,62089,58520,12365,20783,34298,18118,37395,
10.413 + 62321,10148,12725,58720,33794,20695,43040,31989,7575,51522,
10.414 + 57171,2950,27364,48689,34583,21442,12960,58997,61540,9393,
10.415 + 17875,37126,27121,48420,56390,2195,7810,51799,43829,32736,
10.416 + 55673,3500,27854,47131,44554,31455,7101,53096,14239,58186,
10.417 + 33320,22269,16620,37945,62811,8590,6312,52349,44319,31178,
10.418 + 28635,47886,55916,3769,63054,8859,17401,38700,33085,21992,
10.419 + 13450,57439,26021,45424,53266,1223,4822,50691,42849,29620,
10.420 + 35651,24470,16116,59937,64560,10469,18823,40274,42100,28833,
10.421 + 4547,50454,54023,2002,26288,45669,19090,40519,65317,11248,
10.422 + 15841,59700,34902,23683,64026,11983,20397,39800,36201,22972,
10.423 + 14558,60427,5372,49193,41291,30110,25487,46938,54840,749,
10.424 + 15307,61214,36476,23209,19640,39021,63759,11738,54573,504,
10.425 + 24730,46159,41566,30347,6121,49980,
10.426 +},
10.427 +{0,58597,54743,12594,47027,21334,25188,34433,29563,38814,
10.428 + 42668,16969,50376,8237,4383,62970,59126,531,13089,55236,
10.429 + 20805,46496,33938,24695,38285,29032,16474,42175,8766,50907,
10.430 + 63465,4876,53745,13588,1062,57539,26178,33447,45973,22384,
10.431 + 41610,18031,30557,37816,5433,61916,49390,9227,14087,54242,
10.432 + 58064,1589,32948,25681,21859,45446,17532,41113,37291,30030,
10.433 + 62415,5930,9752,49917,49151,23322,27176,36557,2124,60585,
10.434 + 56731,14718,52356,10337,6483,64950,31543,40914,44768,18949,
10.435 + 22793,48620,36062,26683,61114,2655,15213,57224,10866,52887,
10.436 + 65445,6976,40385,31012,18454,44275,28174,35563,48089,24380,
10.437 + 55741,15704,3178,59535,7541,63888,51362,11335,43718,20003,
10.438 + 32529,39924,35064,27677,23855,47562,16203,56238,60060,3705,
10.439 + 64387,8038,11860,51889,19504,43221,39399,32002,25571,34566,
10.440 + 46644,21201,54352,12469,391,58722,4248,62589,50511,8618,
10.441 + 42795,17358,29436,38425,34069,25072,20674,46119,12966,54851,
10.442 + 59249,916,63086,4747,9145,51036,16861,42296,37898,28911,
10.443 + 45586,22263,26565,33568,1441,57668,53366,13459,49513,9612,
10.444 + 5310,61531,30426,37439,41741,18408,21732,45057,33075,26070,
10.445 + 58199,1970,13952,53861,10143,50042,62024,5805,36908,29897,
10.446 + 17915,41246,56348,14585,2507,60718,27567,36682,48760,23197,
10.447 + 44903,19330,31408,40533,6356,64561,52483,10726,15082,56847,
10.448 + 61245,3032,36185,27068,22670,48235,18833,44404,40006,30883,
10.449 + 65058,6855,11253,53008,3565,59656,55354,15583,47710,24251,
10.450 + 28553,35692,32406,39539,43841,20388,51493,11712,7410,63511,
10.451 + 60187,4094,16076,55849,23720,47181,35199,28058,39008,31877,
10.452 + 19895,43346,12243,52022,64004,7905,
10.453 +},
10.454 +{0,64765,58855,6426,55251,11054,12852,52937,46011,20294,
10.455 + 22108,43681,25704,39061,33167,32114,31595,34710,40588,25201,
10.456 + 44216,20549,18783,46498,51408,13357,11575,53706,7939,58366,
10.457 + 64228,1561,63190,2603,4913,61388,8453,56824,50402,14367,
10.458 + 17773,47504,41098,23671,37566,28227,30553,35748,36285,28992,
10.459 + 26714,38055,23150,42643,49033,17268,15878,49915,56289,10012,
10.460 + 59861,5416,3122,61647,61873,3404,5206,59563,9826,55967,
10.461 + 50053,16248,16906,48887,42989,23312,38361,26916,28734,36035,
10.462 + 35546,30247,28477,37824,23817,41460,47342,17427,14689,50588,
10.463 + 56454,8315,61106,4687,2901,63400,1895,64410,57984,7805,
10.464 + 53428,11337,13651,51630,46300,18465,20795,44486,25359,40946,
10.465 + 34536,31253,31756,33009,39403,25878,43999,22306,20024,45765,
10.466 + 53175,13130,10832,54957,6244,58521,64899,382,65407,898,
10.467 + 6808,58981,10412,54353,52555,12726,19652,45113,43299,21982,
10.468 + 39703,26602,32496,33293,33812,30953,25075,40206,21447,44858,
10.469 + 46624,19165,14255,52050,53832,11957,57468,7297,1435,63846,
10.470 + 2473,62804,60494,4275,56954,8839,15261,51040,47634,18159,
10.471 + 24565,41736,28097,37180,34854,29915,29378,36415,38693,27608,
10.472 + 42257,23020,16630,48139,49529,15748,9374,55395,5802,59991,
10.473 + 62285,4016,3790,62003,60201,6100,55581,9696,15610,49159,
10.474 + 48501,16776,22674,42095,27302,38491,36673,29628,30117,35160,
10.475 + 36930,27839,41590,24203,18321,47980,50718,15075,9209,57092,
10.476 + 4557,60720,62506,2263,63512,1253,7679,57602,12235,54070,
10.477 + 51756,14033,19363,46942,44612,21177,40048,24717,31127,34154,
10.478 + 33651,32654,26260,39529,21664,43101,45383,19898,12488,52277,
10.479 + 54575,10706,59163,7142,764,65025,
10.480 +},
10.481 +{0,61681,65023,3342,59363,5906,6684,60141,54235,9002,
10.482 + 11812,57045,13368,50377,51655,14646,48043,19290,18004,46757,
10.483 + 23624,44217,41399,20806,26736,39041,38287,25982,36755,32610,
10.484 + 29292,33437,27467,39866,38580,26181,36008,31833,29015,33190,
10.485 + 47248,18529,17775,46494,24435,44930,41612,21117,53472,8209,
10.486 + 11551,56814,14083,51186,51964,14861,827,62410,65220,3637,
10.487 + 58584,5161,6439,59862,54934,9831,11113,56216,12661,49540,
10.488 + 52362,15483,1357,62908,63666,2115,58030,4703,8017,61344,
10.489 + 27965,40396,37058,24627,35550,31279,30497,34768,48870,19991,
10.490 + 17177,46056,22789,43508,42234,21515,48605,19756,16418,45267,
10.491 + 23102,43727,42945,22320,28166,40695,37881,25352,35301,30996,
10.492 + 29722,34027,1654,63111,64393,2936,57749,4452,7274,60571,
10.493 + 54701,9564,10322,55459,12878,49855,53169,16192,45361,16832,
10.494 + 19662,48191,22226,42531,43821,23516,25322,37403,40725,28644,
10.495 + 34057,30200,30966,34823,2714,64107,63333,1940,60793,7560,
10.496 + 4230,57463,55617,10672,9406,54351,16034,52819,50013,13228,
10.497 + 55930,10891,10117,55156,15769,52584,49254,12439,2465,63824,
10.498 + 62558,1199,60994,7859,5053,58188,25041,37152,39982,27871,
10.499 + 34354,30403,31693,35644,45578,17147,20469,48900,21993,42264,
10.500 + 43030,22759,26535,38742,39512,27305,32836,28853,32187,36170,
10.501 + 46204,17549,18819,47474,21407,41838,44640,24209,56332,11517,
10.502 + 8691,53506,15343,51998,50704,14049,4055,65318,61992,729,
10.503 + 59444,6341,5579,58682,3308,64541,61715,482,60175,7166,
10.504 + 5872,58881,57143,12230,8904,53817,14548,51237,50475,13786,
10.505 + 46919,18358,19128,47689,20644,41045,44379,23978,25756,37997,
10.506 + 39267,27026,33663,29582,32384,36465,
10.507 +},
10.508 +{0,63223,61939,1796,65531,2316,3592,63743,58347,5404,
10.509 + 4632,58607,7184,60135,60899,6932,56267,11580,10808,56527,
10.510 + 9264,53959,54723,9012,14368,52951,51667,16164,51163,12588,
10.511 + 13864,49375,43915,23932,23160,44175,21616,41607,42371,21364,
10.512 + 18528,48791,47507,20324,47003,16748,18024,45215,28736,34487,
10.513 + 33203,30532,36795,31052,32328,35007,37803,25948,25176,38063,
10.514 + 27728,39591,40355,27476,19211,48636,47864,19471,46320,16903,
10.515 + 17667,46068,43232,24087,22803,45028,22299,41452,42728,20511,
10.516 + 37056,26167,24883,38852,28475,39372,40648,26687,29483,34268,
10.517 + 33496,29743,36048,31271,32035,35796,57472,5751,4467,59268,
10.518 + 8059,59788,61064,6271,875,62876,62104,1135,64656,2663,
10.519 + 3427,64404,15179,52668,51896,15439,50352,12871,13635,50100,
10.520 + 55456,11863,10579,57252,10075,53676,54952,8287,38422,24801,
10.521 + 26597,37138,27117,40730,38942,28393,30205,33546,33806,29433,
10.522 + 35334,31985,31733,36098,19933,47914,48174,19161,45606,17617,
10.523 + 17365,46370,44598,22721,24517,43314,20941,42810,41022,22217,
10.524 + 15773,52074,52334,15001,49766,13457,13205,50530,56950,10369,
10.525 + 12165,55666,8589,55162,53374,9865,58966,4257,6053,57682,
10.526 + 6573,61274,59486,7849,1469,62282,62542,697,64070,3249,
10.527 + 2997,64834,56605,11242,11502,55833,8934,54289,54037,9698,
10.528 + 16118,51201,52997,14834,49421,14330,12542,50697,1750,61473,
10.529 + 63269,466,63789,4058,2270,65065,58685,5066,5326,57913,
10.530 + 6854,60465,60213,7618,30358,32865,34661,29074,35181,32666,
10.531 + 30878,36457,38269,25482,25742,37497,27270,40049,39797,28034,
10.532 + 44381,23466,23726,43609,21158,42065,41813,21922,20150,47169,
10.533 + 48965,18866,45389,18362,16574,46665,
10.534 +},
10.535 +{0,62964,63477,513,62455,1539,1026,61942,64499,3591,
10.536 + 3078,63986,2052,65008,65521,2565,60411,7695,7182,59898,
10.537 + 6156,60920,61433,6669,4104,58876,59389,4617,58367,5643,
10.538 + 5130,57854,52203,15903,15390,51690,14364,52712,53225,14877,
10.539 + 12312,50668,51181,12825,50159,13851,13338,49646,8208,54756,
10.540 + 55269,8721,54247,9747,9234,53734,56291,11799,11286,55778,
10.541 + 10260,56800,57313,10773,35787,32319,31806,35274,30780,36296,
10.542 + 36809,31293,28728,34252,34765,29241,33743,30267,29754,33230,
10.543 + 24624,38340,38853,25137,37831,26163,25650,37318,39875,28215,
10.544 + 27702,39362,26676,40384,40897,27189,16416,46548,47061,16929,
10.545 + 46039,17955,17442,45526,48083,20007,19494,47570,18468,48592,
10.546 + 49105,18981,43995,24111,23598,43482,22572,44504,45017,23085,
10.547 + 20520,42460,42973,21033,41951,22059,21546,41438,2955,65151,
10.548 + 64638,2442,63612,3464,3977,64125,61560,1420,1933,62073,
10.549 + 911,63099,62586,398,57456,5508,6021,57969,4999,58995,
10.550 + 58482,4486,7043,61047,60534,6530,59508,7552,8065,60021,
10.551 + 49248,13716,14229,49761,13207,50787,50274,12694,15251,52839,
10.552 + 52326,14738,51300,15760,16273,51813,11163,56943,56430,10650,
10.553 + 55404,11672,12185,55917,53352,9628,10141,53865,9119,54891,
10.554 + 54378,8606,32832,30132,30645,33345,29623,34371,33858,29110,
10.555 + 31667,36423,35910,31154,34884,32176,32689,35397,27579,40527,
10.556 + 40014,27066,38988,28088,28601,39501,36936,26044,26557,37449,
10.557 + 25535,38475,37962,25022,19371,48735,48222,18858,47196,19880,
10.558 + 20393,47709,45144,17836,18349,45657,17327,46683,46170,16814,
10.559 + 41040,21924,22437,41553,21415,42579,42066,20902,23459,44631,
10.560 + 44118,22946,43092,23968,24481,43605,
10.561 +},
10.562 +{0,31355,62710,36493,62961,36746,263,31612,63487,36228,
10.563 + 777,31090,526,30837,63224,35971,62435,35224,1813,32110,
10.564 + 1554,31849,62180,34975,1052,32359,61674,35473,61933,35734,
10.565 + 1307,32608,64475,33184,3885,30038,3626,29777,64220,32935,
10.566 + 3108,30303,63698,33449,63957,33710,3363,30552,2104,29251,
10.567 + 64718,34485,64969,34738,2367,29508,65479,34236,2865,29002,
10.568 + 2614,28749,65216,33979,60331,37328,8029,25894,7770,25633,
10.569 + 60076,37079,7252,26159,59554,37593,59813,37854,7507,26408,
10.570 + 6216,25139,60606,38597,60857,38850,6479,25396,61367,38348,
10.571 + 6977,24890,6726,24637,61104,38091,4208,27147,58502,40701,
10.572 + 58753,40954,4471,27404,59279,40436,4985,26882,4734,26629,
10.573 + 59016,40179,58259,39400,5989,27934,5730,27673,58004,39151,
10.574 + 5228,28183,57498,39649,57757,39910,5483,28432,52043,45360,
10.575 + 16317,17862,16058,17601,51788,45111,15540,18127,51266,45625,
10.576 + 51525,45886,15795,18376,14504,17107,52318,46629,52569,46882,
10.577 + 14767,17364,53079,46380,15265,16858,15014,16605,52816,46123,
10.578 + 12432,19179,50278,48669,50529,48922,12695,19436,51055,48404,
10.579 + 13209,18914,12958,18661,50792,48147,50035,47368,14213,19966,
10.580 + 13954,19705,49780,47119,13452,20215,49274,47617,49533,47878,
10.581 + 13707,20464,8416,23195,54294,44653,54545,44906,8679,23452,
10.582 + 55071,44388,9193,22930,8942,22677,54808,44131,54019,43384,
10.583 + 10229,23950,9970,23689,53764,43135,9468,24199,53258,43633,
10.584 + 53517,43894,9723,24448,56123,41280,12237,21942,11978,21681,
10.585 + 55868,41031,11460,22207,55346,41545,55605,41806,11715,22456,
10.586 + 10456,21155,56366,42581,56617,42834,10719,21412,57127,42332,
10.587 + 11217,20906,10966,20653,56864,42075,
10.588 +},
10.589 +{0,46002,31609,51403,63218,17728,36235,15929,61945,16971,
10.590 + 35456,14642,1803,46265,31858,53184,65519,19549,33942,14116,
10.591 + 2333,47791,29284,49622,3606,48548,30063,50909,63716,19286,
10.592 + 33693,12335,58307,20593,39098,11016,5425,42627,28232,56826,
10.593 + 4666,41352,26947,56049,58568,22394,40881,11267,7212,44958,
10.594 + 26453,54503,60126,22892,37287,8725,60885,24167,38572,9502,
10.595 + 6951,43157,24670,54252,56219,26665,41186,4944,11625,40667,
10.596 + 22032,58786,10850,39376,20763,58025,56464,28450,42985,5211,
10.597 + 9332,38854,24333,60607,53894,24884,43519,6733,54669,26175,
10.598 + 44788,7494,9087,37069,22534,60340,14424,35818,17185,61587,
10.599 + 52906,32024,46547,1633,51617,31251,45784,362,16211,36065,
10.600 + 17450,63384,51127,29701,48334,3964,12613,33527,19004,63886,
10.601 + 13902,34300,19767,65157,49340,29454,48069,2167,43819,6297,
10.602 + 53330,25568,24025,61035,9888,38162,23250,59744,8619,37401,
10.603 + 44064,8082,55129,25835,21700,59254,12221,39951,41526,4484,
10.604 + 55631,27389,42301,5775,56900,28150,21455,57469,10422,39684,
10.605 + 18664,64346,13201,32803,48666,3496,50531,30417,47377,2723,
10.606 + 49768,29146,20451,64593,13466,34600,46855,1205,52350,32716,
10.607 + 16885,62023,14988,35134,18174,62796,15751,36405,45068,958,
10.608 + 52085,30919,28848,49922,3017,47227,34370,13808,64827,20105,
10.609 + 33097,13051,64048,18818,30651,50185,3266,49008,36703,15597,
10.610 + 62502,18324,31149,51743,724,45414,32422,52500,1503,46701,
10.611 + 34900,15334,62253,16543,37747,8385,59402,23480,25985,54835,
10.612 + 7928,44362,25226,53560,6643,43585,38008,10186,61185,23731,
10.613 + 27804,57134,6117,42071,39534,10716,57623,21157,40293,11991,
10.614 + 58908,21934,27543,55333,4334,41820,
10.615 +},
10.616 +{0,22872,45744,60392,31101,8229,52173,37525,62202,43938,
10.617 + 16458,6418,35719,53983,14647,24687,63977,41137,19289,4609,
10.618 + 32916,55756,12836,27516,2835,21067,47523,57595,29294,11062,
10.619 + 49374,39302,61391,46743,23935,1063,38578,53226,9218,32090,
10.620 + 7477,17517,44933,63197,25672,15632,55032,36768,5670,20350,
10.621 + 42134,64974,28507,13827,56811,33971,58588,48516,22124,3892,
10.622 + 40353,50425,12049,30281,50051,39643,28979,10347,47870,58278,
10.623 + 2126,20758,12665,26657,33737,55953,18436,4444,64180,41964,
10.624 + 14954,25394,35034,53634,17175,6735,61863,43263,51344,37320,
10.625 + 31264,9080,45549,59573,861,23045,11340,29972,40700,51108,
10.626 + 21809,3177,59265,48857,57014,34798,27654,13662,42955,65171,
10.627 + 5499,19491,54693,36093,26389,15949,44248,62848,7784,18224,
10.628 + 10079,32263,38383,52407,24098,1914,60562,46538,39707,49731,
10.629 + 10667,28915,57958,47934,20694,2446,27105,12473,56145,33289,
10.630 + 4252,18884,41516,64372,25330,15274,53314,35098,7055,17111,
10.631 + 43327,61543,36872,51536,8888,31712,59765,45101,23493,669,
10.632 + 29908,11660,50788,40764,3497,21745,48921,58945,34350,57206,
10.633 + 13470,28102,65363,42507,19939,5307,36157,54373,16269,26325,
10.634 + 62528,44312,18160,8104,32711,9887,52599,37935,1722,24546,
10.635 + 46090,60754,22680,448,59944,45936,8677,30909,37717,51725,
10.636 + 43618,62266,6354,16778,54047,35399,25007,14583,41329,63529,
10.637 + 5057,19097,55308,33108,27324,13284,21387,2771,57659,47203,
10.638 + 10998,29614,38982,49438,46935,60943,1511,23743,52778,38770,
10.639 + 31898,9666,17837,7413,63261,44613,15568,25992,36448,55096,
10.640 + 20158,6118,64526,42326,14275,28315,34163,56363,48196,58652,
10.641 + 3828,22444,50489,40033,30601,11985,
10.642 +},
10.643 +{0,11309,22618,29815,45236,40089,59630,50371,32117,20824,
10.644 + 9519,2306,52673,57836,38299,47542,64234,54983,41648,36509,
10.645 + 19038,26227,4612,15913,34719,43954,57285,62440,14123,6918,
10.646 + 28529,17244,59849,50660,45459,40382,22909,30032,295,11530,
10.647 + 38076,47249,52454,57547,9224,2085,31826,20607,4899,16142,
10.648 + 19321,26452,41879,36794,64461,55264,28246,17019,13836,6689,
10.649 + 57058,62159,34488,43669,53135,58274,38869,48120,32571,21270,
10.650 + 10081,2892,45818,40663,60064,50829,590,11875,23060,30265,
10.651 + 13669,6472,27967,16658,34257,43516,56715,61862,18448,25661,
10.652 + 4170,15463,63652,54409,41214,36051,9798,2667,32284,21041,
10.653 + 38642,47839,52904,57989,23347,30494,873,12100,60295,51114,
10.654 + 46045,40944,56492,61569,34038,43227,27672,16437,13378,6255,
10.655 + 41433,36340,63875,54702,4461,15680,18743,25882,33539,44846,
10.656 + 56153,63348,13239,8090,27629,18368,65142,53851,42540,35329,
10.657 + 20162,25327,5784,15029,31209,21956,8627,3486,51549,58736,
10.658 + 37127,48426,1180,10417,23750,28907,46120,38917,60530,49247,
10.659 + 27338,18151,12944,7869,55934,63059,33316,44553,6079,15250,
10.660 + 20453,25544,42763,35622,65361,54140,36896,48141,51322,58455,
10.661 + 8340,3257,30926,21731,60757,49528,46351,39202,24033,29132,
10.662 + 1467,10646,19596,24737,5334,14587,64568,53269,42082,34895,
10.663 + 12793,7636,27043,17806,33101,44384,55575,62778,46694,39499,
10.664 + 60988,49681,1746,11007,24200,29349,51987,59198,37705,48996,
10.665 + 31655,22410,9213,4048,42309,35176,64799,53554,5617,14812,
10.666 + 19883,24966,55344,62493,32874,44103,26756,17577,12510,7411,
10.667 + 24495,29570,2037,11224,61211,49974,46913,39788,8922,3831,
10.668 + 31360,22189,37486,48707,51764,58905,
10.669 +},
10.670 +{0,39065,11567,46518,23134,49863,30577,61416,46268,11301,
10.671 + 39315,266,61154,30331,50125,23380,30053,60924,22602,49363,
10.672 + 12091,47010,532,39565,49625,22848,60662,29807,39815,798,
10.673 + 46760,11825,60106,29267,51173,24444,45204,10253,40379,1314,
10.674 + 24182,50927,29529,60352,1064,40113,10503,45470,40879,1846,
10.675 + 45696,10777,50673,23912,59614,28743,11027,45962,1596,40613,
10.676 + 29005,59860,23650,50427,51593,20752,58534,31807,37847,2894,
10.677 + 48888,9825,32053,58796,20506,51331,10091,49138,2628,37597,
10.678 + 48364,9333,37315,2394,59058,32299,52125,21252,2128,37065,
10.679 + 9599,48614,21006,51863,32545,59320,9027,48090,3692,38645,
10.680 + 31005,57732,21554,52395,38911,3942,47824,8777,52641,21816,
10.681 + 57486,30743,22054,52927,31497,58256,3192,38113,8535,47566,
10.682 + 58010,31235,53173,22316,47300,8285,38379,3442,36623,6038,
10.683 + 41504,15033,54609,19912,63614,24807,15283,41770,5788,36357,
10.684 + 25069,63860,19650,54363,64106,25331,55109,20444,41012,14509,
10.685 + 36123,5506,20182,54863,25593,64352,5256,35857,14759,41278,
10.686 + 26053,64860,18666,53363,16283,42754,4788,35373,53625,18912,
10.687 + 64598,25807,35623,5054,42504,16017,4256,34873,15759,42262,
10.688 + 19198,53863,26577,65352,42012,15493,35123,4522,65090,26331,
10.689 + 54125,19444,18054,56863,27561,62256,7384,33857,12791,43374,
10.690 + 62010,27299,57109,18316,43108,12541,34123,7634,13283,43898,
10.691 + 7884,34389,27069,61732,17554,56331,34655,8134,43632,13033,
10.692 + 56577,17816,61486,26807,44108,13525,33123,6650,62994,28299,
10.693 + 56125,17316,6384,32873,13791,44358,17070,55863,28545,63256,
10.694 + 55593,16816,62470,27807,33655,7150,44632,14017,28053,62732,
10.695 + 16570,55331,14283,44882,6884,33405,
10.696 +},
10.697 +{0,49859,39323,23384,12075,60904,46768,29811,24150,40085,
10.698 + 51149,1294,29053,46014,59622,10789,48300,32367,9527,59380,
10.699 + 37767,20804,2588,51423,58106,8249,31585,47522,52689,3858,
10.700 + 21578,38537,25925,42886,64734,15901,19054,34989,54261,4406,
10.701 + 15123,63952,41608,24651,5176,55035,36259,20320,55785,6954,
10.702 + 16498,33457,63170,13313,28505,44442,34751,17788,7716,56551,
10.703 + 43156,27223,12559,62412,51850,2121,21265,37330,58785,10082,
10.704 + 31802,48889,38108,22047,3399,53124,48119,31028,8812,57519,
10.705 + 30246,46309,61373,11646,22797,39886,49302,597,10352,60083,
10.706 + 45547,29480,1883,50584,40640,23555,45007,27916,13908,62615,
10.707 + 32996,16935,6527,56252,61849,13146,26626,43713,57010,7281,
10.708 + 18217,34282,4963,53664,35576,18491,15432,65163,42451,26384,
10.709 + 19765,36854,54446,5741,25118,41181,64389,14662,35081,19402,
10.710 + 4242,53841,42530,25825,16313,64890,55135,5532,20164,35847,
10.711 + 63604,15031,25071,41772,13733,63334,44094,28413,6798,55373,
10.712 + 33557,16854,27635,43312,62056,12459,17624,34331,56643,8064,
10.713 + 60492,11919,30167,46868,50023,420,23292,38975,45594,28889,
10.714 + 11137,59714,40241,24562,1194,50793,20704,37411,51579,3000,
10.715 + 32715,48392,58960,9363,3766,52341,38701,21998,8605,58206,
10.716 + 47110,31429,17283,33088,55832,6363,27816,44651,62771,14320,
10.717 + 7637,57110,33870,18061,13054,61501,43877,27046,65327,15852,
10.718 + 26292,42103,53252,4807,18847,35676,41337,25530,14562,64033,
10.719 + 36434,19601,6089,54538,9926,58373,48989,32158,2541,52014,
10.720 + 36982,21173,30864,47699,57611,9160,22459,38264,52768,3299,
10.721 + 39530,22697,1009,49458,46401,30594,11482,60953,50236,1791,
10.722 + 23975,40804,60183,10708,29324,45135,
10.723 +},
10.724 +{0,61422,50113,11311,39839,29809,22622,47024,11043,50381,
10.725 + 59618,1804,45244,24402,29565,40083,22086,47528,38279,31337,
10.726 + 52697,8759,3608,57846,32101,37515,48804,20810,59130,2324,
10.727 + 9531,51925,44172,17250,28493,32931,14099,55549,62674,6972,
10.728 + 34735,26689,17518,43904,7216,62430,57329,12319,64202,5412,
10.729 + 14603,55013,24917,36539,41620,19834,53737,15879,4648,64966,
10.730 + 19062,42392,35255,26201,17669,43755,34500,26922,56986,12660,
10.731 + 7515,62133,28198,33224,44519,16905,62905,6743,13944,55702,
10.732 + 4931,64685,53378,16236,35036,26418,19229,42227,14432,55182,
10.733 + 64417,5199,41983,19473,24638,36816,59785,1639,10824,50598,
10.734 + 29206,40440,45527,24121,49834,11588,363,61061,22837,46811,
10.735 + 39668,29978,49103,20513,31758,37856,9296,52158,59281,2175,
10.736 + 38124,31490,22317,47299,3955,57501,52402,9052,35338,26084,
10.737 + 18891,42533,4501,65147,53844,15802,41257,20167,25320,36102,
10.738 + 15030,54616,63863,5785,56396,13218,8077,61539,18387,43069,
10.739 + 33810,27644,63343,6273,13486,56128,27888,33566,44849,16607,
10.740 + 9862,51560,58695,2729,48409,21239,32472,37174,3493,57931,
10.741 + 52836,8586,38458,31188,22011,47637,28864,40750,45825,23791,
10.742 + 60255,1201,10398,51056,23523,46093,38946,30668,49276,12178,
10.743 + 957,60499,53007,8417,3278,58144,21648,47998,38737,30911,
10.744 + 58412,3010,10221,51203,32691,36957,48242,21404,39241,30375,
10.745 + 23176,46438,726,60728,49431,12025,45674,23940,29099,40517,
10.746 + 10741,50715,59956,1498,25475,35949,41026,20396,63516,6130,
10.747 + 15325,54323,18592,42830,35681,25743,54079,15569,4350,65296,
10.748 + 13765,55851,62980,6634,44634,16820,28059,33397,7910,61704,
10.749 + 56615,13001,34169,27287,18104,43350,
10.750 +},
10.751 +{0,30582,61164,39322,49605,46771,12073,22623,40855,59617,
10.752 + 29051,1549,24146,10532,45246,51144,9011,21573,52703,47785,
10.753 + 58102,38272,3098,31596,48292,52178,21064,9534,32097,2583,
10.754 + 37773,58619,18022,12560,43146,57340,34723,61653,26959,7737,
10.755 + 55793,44679,14109,16491,6196,28482,63192,33198,25941,4643,
10.756 + 35769,64719,42128,54246,19068,15626,64194,36276,5166,25432,
10.757 + 15111,19569,54763,41629,36044,64442,25120,5462,19721,14975,
10.758 + 41957,54419,4955,25645,64951,35521,53918,42472,15474,19204,
10.759 + 45055,55433,16659,13925,28218,6476,32982,63392,12392,18206,
10.760 + 56964,43506,61869,34523,8001,26679,51882,48604,9286,21296,
10.761 + 2927,31769,58755,37621,21821,8779,48081,52391,38136,58254,
10.762 + 31252,3426,59801,40687,1909,28675,10332,24362,50864,45510,
10.763 + 30222,376,39138,61332,47051,49341,22823,11857,1413,29427,
10.764 + 60265,39967,50240,45878,10924,24026,39442,60772,29950,904,
10.765 + 23511,11425,46395,49741,9910,20928,51290,48940,59251,36869,
10.766 + 2463,32489,47393,52823,22477,8379,30948,3986,38408,57726,
10.767 + 17379,13461,44303,55929,33318,62800,27850,7100,56436,43778,
10.768 + 12952,17902,7601,27335,62301,33835,24784,6054,36412,63818,
10.769 + 41237,54883,20473,14479,65351,34865,4523,26333,16002,18932,
10.770 + 53358,42776,35145,65087,26533,4307,18572,16378,42592,53526,
10.771 + 5854,25000,63538,36676,55067,41069,14839,20097,43642,56588,
10.772 + 17558,13280,27583,7369,34131,61989,13805,17051,56065,44151,
10.773 + 62504,33630,6852,28082,53039,47193,8643,22197,3818,31132,
10.774 + 57350,38768,20664,10190,48724,51490,37245,58891,32657,2279,
10.775 + 60444,39786,752,30086,11737,23215,49973,46147,29579,1277,
10.776 + 40295,59921,45646,50488,23714,11220,
10.777 +},
10.778 +{0,15162,30324,19790,60648,55250,39580,41382,50637,65271,
10.779 + 46009,34947,10533,4639,24401,25707,38791,44221,57843,56009,
10.780 + 31599,16469,3355,13857,21066,26992,9278,7940,48802,34200,
10.781 + 51414,62444,13075,2089,17767,32349,57339,58561,43407,37557,
10.782 + 63198,52708,32938,48016,6710,8460,27714,22392,42132,40878,
10.783 + 53984,59866,18556,29510,15880,1330,24921,23139,5933,11287,
10.784 + 36273,46731,64453,49407,26150,23836,4178,11112,35534,45556,
10.785 + 64698,51072,41963,39121,54687,61093,20227,29753,14711,589,
10.786 + 61857,51867,34773,48367,7497,9843,27453,20487,13420,3926,
10.787 + 16920,31010,55428,58302,44784,38346,21813,28175,9025,6267,
10.788 + 47581,33511,53161,62611,37112,43970,59020,56758,31760,18218,
10.789 + 2660,12638,49842,63880,46278,36860,11866,5472,22574,25364,
10.790 + 1919,15429,28939,18993,60311,53421,40419,42713,52300,63350,
10.791 + 47672,33026,8356,7070,22224,28138,2433,12987,32757,17615,
10.792 + 58729,56915,37661,43047,23499,24817,11711,5765,46883,35865,
10.793 + 49495,64109,40454,42300,59506,54088,29422,18900,1178,16288,
10.794 + 65375,50277,35115,45585,5047,10381,26051,24313,14994,424,
10.795 + 19686,30684,54906,60736,40974,39732,26840,21474,7852,9622,
10.796 + 33840,48906,62020,51582,44309,38447,56161,57435,16893,31431,
10.797 + 14217,3251,43626,37200,56350,59172,18050,32184,12534,3020,
10.798 + 28583,21661,6611,8937,33615,47221,62779,52737,15853,1751,
10.799 + 19353,28835,53509,59967,42865,40011,63520,49946,36436,46446,
10.800 + 5320,12274,25276,22918,39289,41539,61197,54327,30097,20139,
10.801 + 997,14559,23732,26510,10944,4602,45148,35686,50728,64786,
10.802 + 3838,13764,30858,17328,57878,55596,37986,44888,52019,61449,
10.803 + 48455,34429,10203,7393,20911,27285,
10.804 +},
10.805 +{0,7452,14904,10020,29808,26988,20040,21332,59616,62972,
10.806 + 53976,53188,40080,33164,42664,48052,52701,53441,63461,60153,
10.807 + 47533,42161,33685,40585,9533,14369,7941,537,20813,19537,
10.808 + 27509,30313,34727,39611,48543,41091,62423,61131,51695,54515,
10.809 + 28487,29275,21887,18531,6967,1579,8463,15379,19066,22374,
10.810 + 28738,27998,15882,8982,1074,6446,41626,49030,39074,34238,
10.811 + 55018,52214,60626,61902,4947,3663,10603,13431,26403,31295,
10.812 + 23835,16391,64435,59055,49547,56471,36803,37599,46587,43239,
10.813 + 56974,50066,58550,63914,43774,47074,37062,36314,13934,11122,
10.814 + 3158,4426,16926,24322,30758,25914,38132,35304,44748,46032,
10.815 + 57476,64920,55996,51104,31764,24840,17964,23344,2148,5496,
10.816 + 12892,12096,22825,17461,25361,32269,11609,12357,5985,2685,
10.817 + 45513,44245,35825,38637,50617,55461,65409,58013,9894,15290,
10.818 + 7326,386,21206,20426,26862,30194,52806,54106,62590,59746,
10.819 + 47670,42794,32782,40210,60283,63079,53571,52319,40715,33303,
10.820 + 42291,47151,923,7815,14755,9407,30699,27383,19923,20687,
10.821 + 41217,48157,39737,34341,54641,51309,61257,62037,18913,21757,
10.822 + 29657,28357,15761,8333,1961,6837,27868,29120,22244,19448,
10.823 + 6316,1456,8852,16264,33852,39200,48644,41752,61516,60752,
10.824 + 51828,55144,13813,10473,4045,4817,16773,23705,31677,26273,
10.825 + 56597,49161,59181,64049,43365,46201,37725,36417,63528,58676,
10.826 + 49680,57100,35928,37188,46688,43900,4296,3540,10992,14316,
10.827 + 25784,31140,24192,17308,45650,44878,34922,38262,50722,56126,
10.828 + 64538,57606,23218,18350,24714,32150,11970,13278,5370,2534,
10.829 + 32655,25235,17847,22699,3071,5859,12743,11483,38767,35443,
10.830 + 44375,45131,58143,65027,55591,50235,
10.831 +},
10.832 +{0,3599,7198,4625,14396,13875,9250,10797,28792,32375,
10.833 + 27750,25193,18500,17995,21594,23125,57584,61183,64750,62177,
10.834 + 55500,54979,50386,51933,37000,40583,35990,33433,43188,42683,
10.835 + 46250,47781,56829,54258,49635,53228,58817,60366,63967,63440,
10.836 + 44421,41866,45467,49044,38329,39862,35239,34728,15629,13058,
10.837 + 8467,12060,1329,2878,6447,5920,19829,17274,20843,24420,
10.838 + 30025,31558,26967,26456,42983,43496,48121,46582,40923,37332,
10.839 + 33733,36298,55199,55696,52097,50574,61347,57772,62397,64946,
10.840 + 18199,18712,23305,21766,32555,28964,25397,27962,14191,14688,
10.841 + 11121,9598,3923,348,4941,7490,31258,29717,26116,26635,
10.842 + 16934,19497,24120,20535,2658,1133,5756,6259,12894,15441,
10.843 + 11840,8271,39658,38117,34548,35067,41686,44249,48840,45255,
10.844 + 60050,58525,63116,63619,53934,56481,52912,49343,21459,24028,
10.845 + 20429,16834,27631,26080,30705,31230,9131,11684,16309,12730,
10.846 + 7063,5528,1929,2438,45859,48428,44861,41266,35615,34064,
10.847 + 38657,39182,50011,52564,57157,53578,64359,62824,59257,59766,
10.848 + 36398,32801,37424,39999,46610,47133,43532,41987,65110,61529,
10.849 + 57928,60487,50794,51301,55924,54395,28382,24785,29376,31951,
10.850 + 22242,22765,19196,17651,7846,4265,696,3255,9882,10389,
10.851 + 14980,13451,62516,64059,59434,58917,52232,49671,53270,56857,
10.852 + 33868,35395,38994,38493,48240,45695,41070,44641,5316,6859,
10.853 + 2266,1749,11512,8951,12518,16105,25788,27315,30882,30381,
10.854 + 23680,21135,16542,20113,10697,10182,13783,15320,4597,8186,
10.855 + 3563,996,22961,22462,17839,19360,24973,28546,32147,29596,
10.856 + 51513,50998,54567,56104,61701,65290,60699,58132,47425,46926,
10.857 + 42335,43856,33149,36722,40291,37740,
10.858 +},
10.859 +{0,35208,3853,34437,7706,38802,4375,39071,15412,46524,
10.860 + 13113,47793,8750,43942,11555,42155,30824,61920,30565,65261,
10.861 + 26226,61434,27007,57591,17500,52692,19281,49881,23110,54222,
10.862 + 21835,56515,61648,31064,65501,30293,61130,26434,57799,26703,
10.863 + 52452,17772,50153,19041,54014,23414,56819,21627,35000,304,
10.864 + 34741,3645,38562,7978,39343,4135,46220,15620,48001,12809,
10.865 + 43670,8990,42395,11283,64957,29749,62128,31544,58279,27183,
10.866 + 60586,25890,49545,18433,52868,18188,57235,22043,53406,22806,
10.867 + 34261,3165,35544,848,39887,4679,38082,7498,47585,12393,
10.868 + 46828,16228,43003,11891,43254,8574,3437,34021,608,35816,
10.869 + 4983,39679,7290,38386,12633,47313,15956,47068,12099,42699,
10.870 + 8270,43462,29957,64653,31240,62336,27423,58007,25618,60826,
10.871 + 18737,49337,17980,53172,22315,56995,22566,53678,59239,28399,
10.872 + 59498,25058,63869,28917,63088,32760,56147,21211,54366,24022,
10.873 + 50505,19649,51780,17356,40719,5767,36866,6538,33045,2205,
10.874 + 36376,1936,41787,10931,44086,9662,48417,13481,45612,15268,
10.875 + 6071,40511,6330,37170,2477,32805,1696,36648,11139,41483,
10.876 + 9358,44294,13721,48145,14996,45852,28639,58967,24786,59738,
10.877 + 29125,63565,32456,63296,21483,55907,23782,54638,19953,50297,
10.878 + 17148,52084,6874,37714,5591,40031,1216,36168,3021,33349,
10.879 + 9966,44902,10723,41067,14580,45436,14329,48753,25266,60218,
10.880 + 28095,58423,31912,62752,29605,64045,24198,55054,20875,55299,
10.881 + 16540,51476,20369,50713,59914,25474,58631,27791,62480,32152,
10.882 + 64285,29333,54846,24502,55603,20667,51236,16812,50985,20129,
10.883 + 37474,7146,40303,5351,35960,1520,33653,2813,44630,10206,
10.884 + 41307,10451,45132,14788,48961,14025,
10.885 +},
10.886 +{0,17477,34954,52431,3337,18764,34179,49606,6674,24151,
10.887 + 37528,55005,5915,21342,40849,56276,13348,28769,48302,63723,
10.888 + 14637,32104,45479,62946,11830,27251,42684,58105,9023,26490,
10.889 + 43957,61424,26696,11277,57538,42119,25921,8452,60875,43406,
10.890 + 29274,13855,64208,48789,32595,15126,63449,45980,23660,6185,
10.891 + 54502,37027,20837,5408,55791,40362,18046,571,52980,35505,
10.892 + 19319,3890,50173,34744,53392,38101,22554,7263,56729,39388,
10.893 + 21779,4438,51842,36551,16904,1613,51083,33742,20225,2884,
10.894 + 58548,41201,27710,10363,59837,44536,24887,9586,65190,47843,
10.895 + 30252,12905,62383,47082,31525,16224,47320,64669,12370,29719,
10.896 + 46545,61844,15707,31006,41674,59023,10816,28165,44995,60294,
10.897 + 10057,25356,36092,51385,1142,16435,33269,50608,2431,19770,
10.898 + 38638,53931,7780,23073,39911,57250,4973,22312,48445,63864,
10.899 + 13751,29170,45108,62577,14526,31995,42799,58218,12197,27616,
10.900 + 43558,61027,8876,26345,35097,52572,403,17878,33808,49237,
10.901 + 3226,18655,37643,55118,7041,24516,40450,55879,5768,21197,
10.902 + 54645,37168,24063,6586,55420,39993,20726,5299,53095,35618,
10.903 + 18413,936,49774,34347,19172,3745,57681,42260,27099,11678,
10.904 + 60504,43037,25810,8343,64323,48902,29641,14220,63050,45583,
10.905 + 32448,14981,28077,10728,58663,41314,24740,9441,59438,44139,
10.906 + 30655,13306,65333,47984,31414,16115,62012,46713,22921,7628,
10.907 + 53507,38214,21632,4293,56330,38991,17307,2014,51985,36692,
10.908 + 20114,2775,50712,33373,1509,16800,36207,51498,2284,19625,
10.909 + 32870,50211,8183,23474,38781,54072,4862,22203,39540,56881,
10.910 + 12737,30084,47435,64782,15560,30861,46146,61447,11219,28566,
10.911 + 41817,59164,9946,25247,44624,59925,
10.912 +},
10.913 +{0,44205,17735,59882,35470,9763,53193,25444,2305,42412,
10.914 + 19526,57579,33679,12066,50888,27237,4610,48815,22341,64488,
10.915 + 39052,13345,56779,29030,6915,47022,24132,62185,37261,15648,
10.916 + 54474,30823,9220,34985,24899,52718,44682,551,60365,18272,
10.917 + 11525,33192,26690,50415,42891,2854,58060,20065,13830,39595,
10.918 + 29505,57324,48264,4133,63951,21858,16135,37802,31296,55021,
10.919 + 46473,6436,61646,23651,18440,58533,3407,41442,49798,28203,
10.920 + 34753,11116,16649,60836,1102,43235,52103,26410,36544,8813,
10.921 + 23050,63143,8013,46048,53380,31785,38339,14702,21259,65446,
10.922 + 5708,47841,55685,29992,40130,12399,27660,49313,10571,34278,
10.923 + 59010,18991,41925,3944,25869,51616,8266,36071,61315,17198,
10.924 + 43716,1641,32270,53923,15177,38884,62592,22573,45511,7530,
10.925 + 30479,56226,12872,40677,64897,20780,47302,5227,36880,15549,
10.926 + 54615,31226,6814,46643,24537,62324,39185,13756,56406,28923,
10.927 + 5023,48946,22232,64117,33298,11967,51029,27640,2204,42033,
10.928 + 19931,57718,35603,10174,52820,25337,413,44336,17626,59511,
10.929 + 46100,6329,61779,24062,16026,37431,31709,55152,48405,4536,
10.930 + 63570,21759,14235,39734,29404,56945,42518,2747,58193,20476,
10.931 + 11416,32821,27103,50546,44823,954,59984,18173,9625,35124,
10.932 + 24798,52339,55320,29877,40287,12786,21142,65083,6097,47996,
10.933 + 53529,32180,37982,14579,23447,63290,7888,45693,51738,26295,
10.934 + 36701,9200,16532,60473,1491,43390,49947,28598,34396,10993,
10.935 + 18837,58680,3282,41087,64540,20657,47451,5622,30354,55871,
10.936 + 13269,40824,62749,22960,45146,7415,32659,54078,15060,38521,
10.937 + 60958,17075,43865,2036,25744,51261,8663,36218,59167,19378,
10.938 + 41560,3829,28049,49468,10454,33915,
10.939 +},
10.940 +{0,55513,44463,30070,18243,40858,60140,12853,36486,22111,
10.941 + 9001,64496,51653,4380,25706,48307,273,55752,44222,29799,
10.942 + 18002,40587,60413,13092,36759,22350,8760,64225,51412,4109,
10.943 + 25979,48546,546,56059,44941,30548,17761,40376,59598,12311,
10.944 + 36004,21629,8459,63954,52199,4926,26184,48785,819,56298,
10.945 + 44700,30277,17520,40105,59871,12550,36277,21868,8218,63683,
10.946 + 51958,4655,26457,49024,1092,56477,43499,28978,17159,39902,
10.947 + 61096,13937,35522,21019,10093,65460,52609,5464,24622,47351,
10.948 + 1365,56716,43258,28707,16918,39631,61369,14176,35795,21258,
10.949 + 9852,65189,52368,5193,24895,47590,1638,57023,43977,29456,
10.950 + 16677,39420,60554,13395,35040,20537,9551,64918,53155,6010,
10.951 + 25100,47829,1911,57262,43736,29185,16436,39149,60827,13634,
10.952 + 35313,20776,9310,64647,52914,5739,25373,48068,2184,53329,
10.953 + 42279,32254,20427,38674,57956,15037,34318,24279,11169,62328,
10.954 + 49485,6548,27874,46139,2457,53568,42038,31983,20186,38403,
10.955 + 58229,15276,34591,24518,10928,62057,49244,6277,28147,46378,
10.956 + 2730,53875,42757,32732,19945,38192,57414,14495,33836,23797,
10.957 + 10627,61786,50031,7094,28352,46617,3003,54114,42516,32461,
10.958 + 19704,37921,57687,14734,34109,24036,10386,61515,49790,6823,
10.959 + 28625,46856,3276,54293,41315,31162,19343,37718,58912,16121,
10.960 + 33354,23187,12261,63292,50441,7632,26790,45183,3549,54532,
10.961 + 41074,30891,19102,37447,59185,16360,33627,23426,12020,63021,
10.962 + 50200,7361,27063,45422,3822,54839,41793,31640,18861,37236,
10.963 + 58370,15579,32872,22705,11719,62750,50987,8178,27268,45661,
10.964 + 4095,55078,41552,31369,18620,36965,58643,15818,33145,22944,
10.965 + 11478,62479,50746,7907,27541,45900,
10.966 +},
10.967 +{0,58083,55771,15160,44971,19784,30320,38035,17227,41384,
10.968 + 39568,30835,60640,3587,13627,55256,34454,25717,24397,48558,
10.969 + 10557,52190,61670,4613,50653,10046,7174,65253,27254,34965,
10.970 + 45997,20814,4401,62418,51434,10761,48794,23673,26433,34210,
10.971 + 21114,45209,35745,26946,64977,7986,9226,50921,38823,30020,
10.972 + 20092,44191,14348,56047,57815,820,54508,13839,3383,61396,
10.973 + 31559,39332,41628,16511,8802,49281,64441,6490,36297,28458,
10.974 + 21522,46833,24873,33738,47346,23057,52866,11361,5977,62906,
10.975 + 42228,17943,32047,40908,2911,59836,53892,12391,59327,1372,
10.976 + 15972,56455,18452,43767,37327,29484,13139,53680,60040,2155,
10.977 + 40184,32283,17699,42944,28696,37627,43459,19232,57267,15696,
10.978 + 1640,58507,46533,22310,27678,36605,6766,63629,50101,8534,
10.979 + 63118,5229,12117,52662,22821,48070,33022,25117,17604,42535,
10.980 + 40223,32764,60271,2444,12980,53335,1935,58732,56916,15543,
10.981 + 43044,19143,29183,37660,49746,8369,7049,63850,28153,36634,
10.982 + 46114,22209,33049,25594,22722,47649,11954,52305,63337,5514,
10.983 + 22005,46870,35886,28365,64094,6333,9093,49510,5822,62557,
10.984 + 53093,11654,47381,23542,24782,33325,54115,12672,2744,59483,
10.985 + 31944,40491,42259,18416,36904,29387,18931,43792,16259,56672,
10.986 + 58968,1211,26278,33861,49021,23966,51469,11246,4310,62005,
10.987 + 9709,50958,64566,7893,35398,26789,21405,45438,57392,723,
10.988 + 14827,56072,20379,44408,38464,29859,41851,16792,31392,38979,
10.989 + 3280,60979,54539,14312,30615,38260,44620,19631,55356,15071,
10.990 + 487,58116,13532,54847,60679,4068,39799,31124,17068,41039,
10.991 + 61697,5090,10458,51769,24234,48201,34673,26002,45642,20649,
10.992 + 27537,35186,7649,65282,50234,9945,
10.993 +},
10.994 +{0,65534,58337,7199,56287,9249,14398,51136,43939,21597,
10.995 + 18498,47036,28796,36738,37789,27747,19291,46245,43194,22340,
10.996 + 36996,28538,29541,35995,57592,7942,793,64743,15143,50393,
10.997 + 55494,10040,38582,26952,30039,35497,19817,45719,44680,20854,
10.998 + 15637,49899,57076,8458,59082,6452,1323,64213,56813,8723,
10.999 + 15884,49650,1586,63948,58835,6701,30286,35248,38319,27217,
10.1000 + 44433,21103,20080,45454,12657,52879,53904,11630,60078,5456,
10.1001 + 2383,63153,39634,25900,31027,34509,16653,48883,41708,23826,
10.1002 + 31274,34260,39371,26165,41461,24075,16916,48618,53641,11895,
10.1003 + 12904,52630,2646,62888,59831,5705,42951,22585,17446,48088,
10.1004 + 31768,33766,40953,24583,3172,62362,61317,4219,55227,10309,
10.1005 + 13402,52132,60572,4962,3965,61571,14147,51389,54434,11100,
10.1006 + 18239,47297,42206,23328,40160,25374,32513,33023,25314,40220,
10.1007 + 33027,32509,47421,18115,23260,42274,51521,14015,10912,54622,
10.1008 + 4766,60768,61823,3713,10681,54855,51800,13734,62054,3480,
10.1009 + 4487,61049,33306,32228,25083,40453,22981,42555,47652,17882,
10.1010 + 62548,2986,6069,59467,12171,53365,52330,13204,24567,40969,
10.1011 + 48150,17384,33832,31702,26569,38967,48911,16625,23790,41744,
10.1012 + 25808,39726,34609,30927,5292,60242,63309,2227,53107,12429,
10.1013 + 11410,54124,21395,44141,45170,20364,34892,30642,27565,37971,
10.1014 + 63536,1998,7121,58415,9199,56337,49166,16368,6344,59190,
10.1015 + 64297,1239,49943,15593,8438,57096,45931,19605,20618,44916,
10.1016 + 26804,38730,35669,29867,50469,15067,9924,55610,7930,57604,
10.1017 + 64795,741,28294,37240,36199,29337,46425,19111,22200,43334,
10.1018 + 36478,29056,28063,37473,21921,43615,46656,18878,9693,55843,
10.1019 + 50748,14786,65026,508,7651,57885,
10.1020 +},
10.1021 +{0,32638,65276,33154,57829,40603,7961,24679,57303,41129,
10.1022 + 8491,24149,15922,16716,49358,49072,41907,56525,23887,8753,
10.1023 + 16982,15656,48298,50132,31844,794,33432,64998,40321,58111,
10.1024 + 25469,7171,23419,9221,42375,56057,47774,50656,17506,15132,
10.1025 + 33964,64466,31312,1326,25929,6711,39861,58571,63688,34742,
10.1026 + 1588,31050,6445,26195,59345,39087,10015,22625,55779,42653,
10.1027 + 50938,47492,14342,18296,46838,51592,18442,14196,22291,10349,
10.1028 + 43503,54929,26913,5727,38877,59555,35012,63418,30264,2374,
10.1029 + 5445,27195,60345,38087,62624,35806,2652,29986,51858,46572,
10.1030 + 13422,19216,11127,21513,54667,43765,60813,37619,4977,27663,
10.1031 + 3176,29462,62100,36330,12890,19748,52390,46040,54207,44225,
10.1032 + 11587,21053,20030,12608,45250,53180,45019,53413,20775,11865,
10.1033 + 37353,61079,28437,4203,28684,3954,36592,61838,29169,3727,
10.1034 + 36621,61555,36884,61290,28392,4502,44582,53592,20698,12196,
10.1035 + 20419,12477,45375,52801,53826,44348,11454,21440,13223,19673,
10.1036 + 52571,45605,3477,29419,62313,35863,60528,37646,4748,28146,
10.1037 + 10890,22004,54390,43784,52079,46097,13715,19181,62813,35363,
10.1038 + 2977,29919,5304,27590,59972,38202,35129,63047,30661,2235,
10.1039 + 26844,6050,38432,59742,22254,10640,43026,55148,46859,51317,
10.1040 + 18935,13961,50951,47225,14843,18053,9954,22940,55326,42848,
10.1041 + 6352,26542,58924,39250,63797,34379,1993,30903,25780,7114,
10.1042 + 39496,58678,34129,64047,31661,1235,47971,50205,17823,15073,
10.1043 + 23174,9720,42106,56068,40060,58114,25216,7678,32153,743,
10.1044 + 33637,64539,17323,15573,48471,49705,41550,56624,23730,9164,
10.1045 + 16335,16561,49459,48717,56874,41300,8406,24488,57368,40806,
10.1046 + 7908,24986,509,32387,65281,32895,
10.1047 +},
10.1048 +{0,16190,32380,16706,64760,50118,33412,48570,58861,56019,
10.1049 + 39825,42159,6421,9771,26473,22615,55239,59641,43451,38533,
10.1050 + 11071,5121,21827,27261,12842,3348,19542,29544,52946,61932,
10.1051 + 45230,36752,45971,36013,52719,62161,20331,28757,12567,3625,
10.1052 + 22142,26944,10242,5948,43654,38328,54522,60356,25684,23402,
10.1053 + 6696,9494,39084,42898,59088,55790,33209,48775,65477,49403,
10.1054 + 32065,17023,829,15363,31547,17413,1351,14969,34755,47357,
10.1055 + 63935,50817,40662,41448,57514,57236,25134,23824,7250,9068,
10.1056 + 44284,37826,53888,60862,20484,28474,11896,4422,18705,30255,
10.1057 + 14189,2131,46569,35543,52117,62635,51368,63382,46804,35306,
10.1058 + 13392,2926,18988,29970,11589,4731,21305,27655,53693,61059,
10.1059 + 44993,37119,8047,8273,24851,24109,58263,56489,40427,41685,
10.1060 + 64130,50620,34046,48064,1658,14660,30726,18232,63094,51528,
10.1061 + 34826,46900,2702,13744,29938,19404,5019,11429,28135,21209,
10.1062 + 61283,53341,37151,44577,8625,7823,24525,24819,56649,57975,
10.1063 + 41781,39947,50268,64354,47648,34078,14500,1946,18136,31206,
10.1064 + 17893,31451,15257,1191,47389,34339,51041,63583,40968,40758,
10.1065 + 56948,57674,23792,25550,8844,7602,37410,44316,60510,54112,
10.1066 + 28378,20964,4262,12184,30671,18673,2483,13965,35639,46089,
10.1067 + 62795,51829,36173,45683,62257,52239,29109,20107,4041,12535,
10.1068 + 26784,22430,5852,10722,37976,43878,59940,54554,23178,26036,
10.1069 + 9462,7112,42610,39244,55310,59184,48999,32857,49435,65061,
10.1070 + 17311,31905,15843,733,16094,480,16546,32668,49702,64792,
10.1071 + 48218,33636,56115,58381,42319,39537,10187,6389,22967,26249,
10.1072 + 59673,54823,38757,43099,5601,10975,27549,21667,3316,13258,
10.1073 + 29320,19894,61452,53042,36464,45390,
10.1074 +},
10.1075 +{0,7966,15932,8482,31864,25446,16964,23898,63728,59374,
10.1076 + 50892,55762,33928,39830,47796,42410,60925,62179,54209,52447,
10.1077 + 37253,36507,44985,45223,5389,2579,11057,13359,26997,30315,
10.1078 + 22345,18519,51175,55545,63963,59077,48031,42113,34211,39613,
10.1079 + 16151,8201,299,7733,17263,23665,32083,25165,10778,13572,
10.1080 + 5158,2872,22114,18812,26718,30528,53994,52724,60630,62408,
10.1081 + 44690,45452,37038,36784,37843,36045,44527,45809,61355,61621,
10.1082 + 53655,52873,27427,29757,21791,18945,5979,2117,10599,13945,
10.1083 + 32302,24880,16402,24332,598,7496,15466,9076,34526,39360,
10.1084 + 47330,43004,64166,58808,50330,56196,21556,19242,27144,29974,
10.1085 + 10316,14162,5744,2414,44228,46042,37624,36326,53436,53154,
10.1086 + 61056,61854,47561,42711,34805,39147,50609,55983,64397,58515,
10.1087 + 16697,24103,32517,24603,15681,8799,893,7267,15291,9381,
10.1088 + 1415,6809,18371,22749,31231,26337,49995,56405,64887,57961,
10.1089 + 48947,41005,33039,40465,54854,51544,59514,63332,43582,46368,
10.1090 + 37890,35612,11958,12712,4234,3988,21198,19920,27890,29676,
10.1091 + 64604,58178,49760,56702,32804,40762,48664,41222,1196,7090,
10.1092 + 14992,9614,30932,26570,18152,23030,4513,3775,12189,12419,
10.1093 + 28121,29383,21477,19707,59729,63055,55149,51315,38185,35383,
10.1094 + 43797,46091,43112,46966,38484,35146,54288,51982,59948,62770,
10.1095 + 20632,20358,28324,29114,11488,13310,4828,3522,17813,23179,
10.1096 + 31657,25783,14829,9971,2001,6351,48485,41595,33625,40007,
10.1097 + 49437,56835,65313,57407,28559,28817,20915,20141,5111,3305,
10.1098 + 11723,13013,38783,34913,43331,46685,60167,62489,54587,51749,
10.1099 + 33394,40300,48206,41808,65034,57620,49206,57128,31362,26012,
10.1100 + 17598,23456,1786,6628,14534,10200,
10.1101 +},
10.1102 +{0,3854,7708,4370,15416,13110,8740,11562,30832,30590,
10.1103 + 26220,26978,17480,19270,23124,21850,61664,65518,61180,57842,
10.1104 + 52440,50134,53956,56778,34960,34718,38540,39298,46248,48038,
10.1105 + 43700,42426,64989,62163,58305,60623,49637,52971,57337,53495,
10.1106 + 34221,35491,39857,38079,47509,46747,42889,43143,3389,563,
10.1107 + 4897,7215,12549,15883,12057,8215,30029,31299,27473,25695,
10.1108 + 18805,18043,22377,22631,59303,59561,63931,63157,56223,54417,
10.1109 + 50563,51853,40919,37081,33227,36549,41967,44257,48627,45821,
10.1110 + 5959,6217,2395,1621,11135,9329,13667,14957,28471,24633,
10.1111 + 28971,32293,21263,23553,19731,16925,6778,5492,1126,2920,
10.1112 + 9794,10572,14430,14160,25098,27908,31766,29464,24114,20796,
10.1113 + 16430,20256,60058,58772,62598,64392,54946,55724,51390,51120,
10.1114 + 37610,40420,36086,33784,44754,41436,45262,49088,54099,56413,
10.1115 + 52559,49729,61291,57445,61815,65145,43811,42029,46399,47665,
10.1116 + 38683,38933,35079,34313,9139,11453,15791,12961,8075,4229,
10.1117 + 407,3737,23491,21709,17887,19153,26619,26869,31207,30441,
10.1118 + 11918,8576,12434,16284,4790,7608,3242,932,22270,23024,
10.1119 + 18658,18412,27334,26056,29914,31700,56942,53600,49266,53116,
10.1120 + 57942,60760,64586,62276,42526,43280,47106,46860,39462,38184,
10.1121 + 33850,35636,13556,15354,10984,9702,2252,1986,5840,6622,
10.1122 + 19588,17290,21144,23958,28860,32690,28320,25006,50196,51994,
10.1123 + 55816,54534,63532,63266,58928,59710,48228,45930,41592,44406,
10.1124 + 32860,36690,40512,37198,51497,50727,55093,55355,62737,64031,
10.1125 + 60173,58371,45401,48727,44869,41035,36193,33391,37757,40051,
10.1126 + 14793,14023,10197,10459,1521,2815,7149,5347,16825,20151,
10.1127 + 24485,20651,32129,29327,25501,27795,
10.1128 +},
10.1129 +{0,1798,3596,2314,7192,6942,4628,5394,14384,16182,
10.1130 + 13884,12602,9256,9006,10788,11554,28768,30566,32364,31082,
10.1131 + 27768,27518,25204,25970,18512,20310,18012,16730,21576,21326,
10.1132 + 23108,23874,57536,59334,61132,59850,64728,64478,62164,62930,
10.1133 + 55536,57334,55036,53754,50408,50158,51940,52706,37024,38822,
10.1134 + 40620,39338,36024,35774,33460,34226,43152,44950,42652,41370,
10.1135 + 46216,45966,47748,48514,56733,55963,54161,54423,49541,50819,
10.1136 + 53129,51343,58797,58027,60321,60583,63925,65203,63417,61631,
10.1137 + 44541,43771,41969,42231,45541,46819,49129,47343,38349,37579,
10.1138 + 39873,40135,35285,36563,34777,32991,15709,14939,13137,13399,
10.1139 + 8517,9795,12105,10319,1389,619,2913,3175,6517,7795,
10.1140 + 6009,4223,19773,19003,17201,17463,20773,22051,24361,22575,
10.1141 + 29965,29195,31489,31751,26901,28179,26393,24607,42791,40993,
10.1142 + 43307,44589,47935,48185,46387,45621,40727,38929,37147,38429,
10.1143 + 33551,33801,36099,35333,55111,53313,55627,56909,52063,52313,
10.1144 + 50515,49749,61303,59505,57723,59005,62319,62569,64867,64101,
10.1145 + 18407,16609,18923,20205,23551,23801,22003,21237,32727,30929,
10.1146 + 29147,30429,25551,25801,28099,27333,14215,12417,14731,16013,
10.1147 + 11167,11417,9619,8853,4023,2225,443,1725,5039,5289,
10.1148 + 7587,6821,31418,32188,29878,29616,26274,24996,26798,28584,
10.1149 + 17034,17804,19590,19328,24210,22932,20638,22424,2778,3548,
10.1150 + 1238,976,5826,4548,6350,8136,13034,13804,15590,15328,
10.1151 + 12018,10740,8446,10232,39546,40316,38006,37744,34402,33124,
10.1152 + 34926,36712,41546,42316,44102,43840,48722,47444,45150,46936,
10.1153 + 59930,60700,58390,58128,62978,61700,63502,65288,53802,54572,
10.1154 + 56358,56096,52786,51508,49214,51000,
10.1155 +},
10.1156 +{0,770,1540,1286,3080,3850,2572,2318,6160,6930,
10.1157 + 7700,7446,5144,5914,4636,4382,12320,13090,13860,13606,
10.1158 + 15400,16170,14892,14638,10288,11058,11828,11574,9272,10042,
10.1159 + 8764,8510,24640,25410,26180,25926,27720,28490,27212,26958,
10.1160 + 30800,31570,32340,32086,29784,30554,29276,29022,20576,21346,
10.1161 + 22116,21862,23656,24426,23148,22894,18544,19314,20084,19830,
10.1162 + 17528,18298,17020,16766,49280,50050,50820,50566,52360,53130,
10.1163 + 51852,51598,55440,56210,56980,56726,54424,55194,53916,53662,
10.1164 + 61600,62370,63140,62886,64680,65450,64172,63918,59568,60338,
10.1165 + 61108,60854,58552,59322,58044,57790,41152,41922,42692,42438,
10.1166 + 44232,45002,43724,43470,47312,48082,48852,48598,46296,47066,
10.1167 + 45788,45534,37088,37858,38628,38374,40168,40938,39660,39406,
10.1168 + 35056,35826,36596,36342,34040,34810,33532,33278,40221,40479,
10.1169 + 39705,38939,37141,37399,38673,37907,34061,34319,33545,32779,
10.1170 + 35077,35335,36609,35843,44349,44607,43833,43067,41269,41527,
10.1171 + 42801,42035,46381,46639,45865,45099,47397,47655,48929,48163,
10.1172 + 64861,65119,64345,63579,61781,62039,63313,62547,58701,58959,
10.1173 + 58185,57419,59717,59975,61249,60483,52605,52863,52089,51323,
10.1174 + 49525,49783,51057,50291,54637,54895,54121,53355,55653,55911,
10.1175 + 57185,56419,23965,24223,23449,22683,20885,21143,22417,21651,
10.1176 + 17805,18063,17289,16523,18821,19079,20353,19587,28093,28351,
10.1177 + 27577,26811,25013,25271,26545,25779,30125,30383,29609,28843,
10.1178 + 31141,31399,32673,31907,15837,16095,15321,14555,12757,13015,
10.1179 + 14289,13523,9677,9935,9161,8395,10693,10951,12225,11459,
10.1180 + 3581,3839,3065,2299,501,759,2033,1267,5613,5871,
10.1181 + 5097,4331,6629,6887,8161,7395,
10.1182 +},
10.1183 +};
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
11.2 +++ b/src/gdrom/edc_scramble.h Sun Mar 02 11:38:08 2008 +0000
11.3 @@ -0,0 +1,621 @@
11.4 +/* @(#)scramble_table 1.2 02/10/19 */
11.5 +
11.6 +/*
11.7 + * This program is free software; you can redistribute it and/or modify
11.8 + * it under the terms of the GNU General Public License version 2
11.9 + * as published by the Free Software Foundation.
11.10 + *
11.11 + * This program is distributed in the hope that it will be useful,
11.12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
11.13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11.14 + * GNU General Public License for more details.
11.15 + *
11.16 + * You should have received a copy of the GNU General Public License along with
11.17 + * this program; see the file COPYING. If not, write to the Free Software
11.18 + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
11.19 + */
11.20 +
11.21 +static const unsigned char yellowbook_scrambler[2340] = {
11.22 + 1,128,0,96,0,40,0,30,128,8,96,6,168,2,254,129,128,96,96,40,40,30,158,
11.23 + 136,104,102,174,170,252,127,1,224,0,72,0,54,128,22,224,14,200,4,86,131,126,225,
11.24 + 224,72,72,54,182,150,246,238,198,204,82,213,253,159,1,168,0,126,128,32,96,24,40,
11.25 + 10,158,135,40,98,158,169,168,126,254,160,64,120,48,34,148,25,175,74,252,55,1,214,
11.26 + 128,94,224,56,72,18,182,141,182,229,182,203,54,215,86,222,190,216,112,90,164,59,59,
11.27 + 83,83,125,253,225,129,136,96,102,168,42,254,159,0,104,0,46,128,28,96,9,232,6,
11.28 + 206,130,212,97,159,104,104,46,174,156,124,105,225,238,200,76,86,181,254,247,0,70,128,
11.29 + 50,224,21,136,15,38,132,26,227,75,9,247,70,198,178,210,245,157,135,41,162,158,249,
11.30 + 168,66,254,177,128,116,96,39,104,26,174,139,60,103,81,234,188,79,49,244,20,71,79,
11.31 + 114,180,37,183,91,54,187,86,243,126,197,224,83,8,61,198,145,146,236,109,141,237,165,
11.32 + 141,187,37,179,91,53,251,87,3,126,129,224,96,72,40,54,158,150,232,110,206,172,84,
11.33 + 125,255,97,128,40,96,30,168,8,126,134,160,98,248,41,130,158,225,168,72,126,182,160,
11.34 + 118,248,38,194,154,209,171,28,127,73,224,54,200,22,214,142,222,228,88,75,122,183,99,
11.35 + 54,169,214,254,222,192,88,80,58,188,19,49,205,212,85,159,127,40,32,30,152,8,106,
11.36 + 134,175,34,252,25,129,202,224,87,8,62,134,144,98,236,41,141,222,229,152,75,42,183,
11.37 + 95,54,184,22,242,142,197,164,83,59,125,211,97,157,232,105,142,174,228,124,75,97,247,
11.38 + 104,70,174,178,252,117,129,231,32,74,152,55,42,150,159,46,232,28,78,137,244,102,199,
11.39 + 106,210,175,29,188,9,177,198,244,82,199,125,146,161,173,184,125,178,161,181,184,119,50,
11.40 + 166,149,186,239,51,12,21,197,207,19,20,13,207,69,148,51,47,85,220,63,25,208,10,
11.41 + 220,7,25,194,138,209,167,28,122,137,227,38,201,218,214,219,30,219,72,91,118,187,102,
11.42 + 243,106,197,239,19,12,13,197,197,147,19,45,205,221,149,153,175,42,252,31,1,200,0,
11.43 + 86,128,62,224,16,72,12,54,133,214,227,30,201,200,86,214,190,222,240,88,68,58,179,
11.44 + 83,53,253,215,1,158,128,104,96,46,168,28,126,137,224,102,200,42,214,159,30,232,8,
11.45 + 78,134,180,98,247,105,134,174,226,252,73,129,246,224,70,200,50,214,149,158,239,40,76,
11.46 + 30,181,200,119,22,166,142,250,228,67,11,113,199,100,82,171,125,191,97,176,40,116,30,
11.47 + 167,72,122,182,163,54,249,214,194,222,209,152,92,106,185,239,50,204,21,149,207,47,20,
11.48 + 28,15,73,196,54,211,86,221,254,217,128,90,224,59,8,19,70,141,242,229,133,139,35,
11.49 + 39,89,218,186,219,51,27,85,203,127,23,96,14,168,4,126,131,96,97,232,40,78,158,
11.50 + 180,104,119,110,166,172,122,253,227,1,137,192,102,208,42,220,31,25,200,10,214,135,30,
11.51 + 226,136,73,166,182,250,246,195,6,209,194,220,81,153,252,106,193,239,16,76,12,53,197,
11.52 + 215,19,30,141,200,101,150,171,46,255,92,64,57,240,18,196,13,147,69,173,243,61,133,
11.53 + 209,163,28,121,201,226,214,201,158,214,232,94,206,184,84,114,191,101,176,43,52,31,87,
11.54 + 72,62,182,144,118,236,38,205,218,213,155,31,43,72,31,118,136,38,230,154,202,235,23,
11.55 + 15,78,132,52,99,87,105,254,174,192,124,80,33,252,24,65,202,176,87,52,62,151,80,
11.56 + 110,188,44,113,221,228,89,139,122,231,99,10,169,199,62,210,144,93,172,57,189,210,241,
11.57 + 157,132,105,163,110,249,236,66,205,241,149,132,111,35,108,25,237,202,205,151,21,174,143,
11.58 + 60,100,17,235,76,79,117,244,39,7,90,130,187,33,179,88,117,250,167,3,58,129,211,
11.59 + 32,93,216,57,154,146,235,45,143,93,164,57,187,82,243,125,133,225,163,8,121,198,162,
11.60 + 210,249,157,130,233,161,142,248,100,66,171,113,191,100,112,43,100,31,107,72,47,118,156,
11.61 + 38,233,218,206,219,20,91,79,123,116,35,103,89,234,186,207,51,20,21,207,79,20,52,
11.62 + 15,87,68,62,179,80,117,252,39,1,218,128,91,32,59,88,19,122,141,227,37,137,219,
11.63 + 38,219,90,219,123,27,99,75,105,247,110,198,172,82,253,253,129,129,160,96,120,40,34,
11.64 + 158,153,168,106,254,175,0,124,0,33,192,24,80,10,188,7,49,194,148,81,175,124,124,
11.65 + 33,225,216,72,90,182,187,54,243,86,197,254,211,0,93,192,57,144,18,236,13,141,197,
11.66 + 165,147,59,45,211,93,157,249,169,130,254,225,128,72,96,54,168,22,254,142,192,100,80,
11.67 + 43,124,31,97,200,40,86,158,190,232,112,78,164,52,123,87,99,126,169,224,126,200,32,
11.68 + 86,152,62,234,144,79,44,52,29,215,73,158,182,232,118,206,166,212,122,223,99,24,41,
11.69 + 202,158,215,40,94,158,184,104,114,174,165,188,123,49,227,84,73,255,118,192,38,208,26,
11.70 + 220,11,25,199,74,210,183,29,182,137,182,230,246,202,198,215,18,222,141,152,101,170,171,
11.71 + 63,63,80,16,60,12,17,197,204,83,21,253,207,1,148,0,111,64,44,48,29,212,9,
11.72 + 159,70,232,50,206,149,148,111,47,108,28,45,201,221,150,217,174,218,252,91,1,251,64,
11.73 + 67,112,49,228,20,75,79,119,116,38,167,90,250,187,3,51,65,213,240,95,4,56,3,
11.74 + 82,129,253,160,65,184,48,114,148,37,175,91,60,59,81,211,124,93,225,249,136,66,230,
11.75 + 177,138,244,103,7,106,130,175,33,188,24,113,202,164,87,59,126,147,96,109,232,45,142,
11.76 + 157,164,105,187,110,243,108,69,237,243,13,133,197,163,19,57,205,210,213,157,159,41,168,
11.77 + 30,254,136,64,102,176,42,244,31,7,72,2,182,129,182,224,118,200,38,214,154,222,235,
11.78 + 24,79,74,180,55,55,86,150,190,238,240,76,68,53,243,87,5,254,131,0,97,192,40,
11.79 + 80,30,188,8,113,198,164,82,251,125,131,97,161,232,120,78,162,180,121,183,98,246,169,
11.80 + 134,254,226,192,73,144,54,236,22,205,206,213,148,95,47,120,28,34,137,217,166,218,250,
11.81 + 219,3,27,65,203,112,87,100,62,171,80,127,124,32,33,216,24,90,138,187,39,51,90,
11.82 + 149,251,47,3,92,1,249,192,66,208,49,156,20,105,207,110,212,44,95,93,248,57,130,
11.83 + 146,225,173,136,125,166,161,186,248,115,2,165,193,187,16,115,76,37,245,219,7,27,66,
11.84 + 139,113,167,100,122,171,99,63,105,208,46,220,28,89,201,250,214,195,30,209,200,92,86,
11.85 + 185,254,242,192,69,144,51,44,21,221,207,25,148,10,239,71,12,50,133,213,163,31,57,
11.86 + 200,18,214,141,158,229,168,75,62,183,80,118,188,38,241,218,196,91,19,123,77,227,117,
11.87 + 137,231,38,202,154,215,43,30,159,72,104,54,174,150,252,110,193,236,80,77,252,53,129,
11.88 + 215,32,94,152,56,106,146,175,45,188,29,177,201,180,86,247,126,198,160,82,248,61,130,
11.89 + 145,161,172,120,125,226,161,137,184,102,242,170,197,191,19,48,13,212,5,159,67,40,49,
11.90 + 222,148,88,111,122,172,35,61,217,209,154,220,107,25,239,74,204,55,21,214,143,30,228,
11.91 + 8,75,70,183,114,246,165,134,251,34,195,89,145,250,236,67,13,241,197,132,83,35,125,
11.92 + 217,225,154,200,107,22,175,78,252,52,65,215,112,94,164,56,123,82,163,125,185,225,178,
11.93 + 200,117,150,167,46,250,156,67,41,241,222,196,88,83,122,189,227,49,137,212,102,223,106,
11.94 + 216,47,26,156,11,41,199,94,210,184,93,178,185,181,178,247,53,134,151,34,238,153,140,
11.95 + 106,229,239,11,12,7,69,194,179,17,181,204,119,21,230,143,10,228,7,11,66,135,113,
11.96 + 162,164,121,187,98,243,105,133,238,227,12,73,197,246,211,6,221,194,217,145,154,236,107,
11.97 + 13,239,69,140,51,37,213,219,31,27,72,11,118,135,102,226,170,201,191,22,240,14,196,
11.98 + 4,83,67,125,241,225,132,72,99,118,169,230,254,202,192,87,16,62,140,16,101,204,43,
11.99 + 21,223,79,24,52,10,151,71,46,178,156,117,169,231,62,202,144,87,44,62,157,208,105,
11.100 + 156,46,233,220,78,217,244,90,199,123,18,163,77,185,245,178,199,53,146,151,45,174,157,
11.101 + 188,105,177,238,244,76,71,117,242,167,5,186,131,51,33,213,216,95,26,184,11,50,135,
11.102 + 85,162,191,57,176,18,244,13,135,69,162,179,57,181,210,247,29,134,137,162,230,249,138,
11.103 + 194,231,17,138,140,103,37,234,155,15,43,68,31,115,72,37,246,155,6,235,66,207,113,
11.104 + 148,36,111,91,108,59,109,211,109,157,237,169,141,190,229,176,75,52,55,87,86,190,190,
11.105 + 240,112,68,36,51,91,85,251,127,3,96,1,232,0,78,128,52,96,23,104,14,174,132,
11.106 + 124,99,97,233,232,78,206,180,84,119,127,102,160,42,248,31,2,136,1,166,128,122,224,
11.107 + 35,8,25,198,138,210,231,29,138,137,167,38,250,154,195,43,17,223,76,88,53,250,151,
11.108 + 3,46,129,220,96,89,232,58,206,147,20,109,207,109,148,45,175,93,188,57,177,210,244,
11.109 + 93,135,121,162,162,249,185,130,242,225,133,136,99,38,169,218,254,219,0,91,64,59,112,
11.110 + 19,100,13,235,69,143,115,36,37,219,91,27,123,75,99,119,105,230,174,202,252,87,1,
11.111 + 254,128,64,96,48,40,20,30,143,72,100,54,171,86,255,126,192,32,80,24,60,10,145,
11.112 + 199,44,82,157,253,169,129,190,224,112,72,36,54,155,86,235,126,207,96,84,40,63,94,
11.113 + 144,56,108,18,173,205,189,149,177,175,52,124,23,97,206,168,84,126,191,96,112,40,36,
11.114 + 30,155,72,107,118,175,102,252,42,193,223,16,88,12,58,133,211,35,29,217,201,154,214,
11.115 + 235,30,207,72,84,54,191,86,240,62,196,16,83,76,61,245,209,135,28,98,137,233,166,
11.116 + 206,250,212,67,31,113,200,36,86,155,126,235,96,79,104,52,46,151,92,110,185,236,114,
11.117 + 205,229,149,139,47,39,92,26,185,203,50,215,85,158,191,40,112,30,164,8,123,70,163,
11.118 + 114,249,229,130,203,33,151,88,110,186,172,115,61,229,209,139,28,103,73,234,182,207,54,
11.119 + 212,22,223,78,216,52,90,151,123,46,163,92,121,249,226,194,201,145,150,236,110,205,236,
11.120 + 85,141,255,37,128,27,32,11,88,7,122,130,163,33,185,216,114,218,165,155,59,43,83,
11.121 + 95,125,248,33,130,152,97,170,168,127,62,160,16,120,12,34,133,217,163,26,249,203,2,
11.122 + 215,65,158,176,104,116,46,167,92,122,185,227,50,201,213,150,223,46,216,28,90,137,251,
11.123 + 38,195,90,209,251,28,67,73,241,246,196,70,211,114,221,229,153,
11.124 +};
11.125 +
11.126 +#ifdef PROTOTYPES
11.127 +
11.128 +# if !defined WORDS_BIGENDIAN
11.129 +/* little endian */
11.130 +static const uint32_t yellowbook_scrambler_uint32[2340/4] = {
11.131 + 0x60008001UL,0x1E002800UL,0x06600880UL,0x81FE02A8UL,0x28606080UL,
11.132 + 0x889E1E28UL,0xAAAE6668UL,0xE0017FFCUL,0x36004800UL,0x0EE01680UL,
11.133 + 0x835604C8UL,0x48E0E17EUL,0x96B63648UL,0xCCC6EEF6UL,0x9FFDD552UL,
11.134 + 0x7E00A801UL,0x18602080UL,0x879E0A28UL,0xA99E6228UL,0xA0FE7EA8UL,
11.135 + 0x22307840UL,0x4AAF1994UL,0xD60137FCUL,0x38E05E80UL,0x8DB61248UL,
11.136 + 0xCBB6E5B6UL,0xDE56D736UL,0x5A70D8BEUL,0x533B3BA4UL,0xE1FD7D53UL,
11.137 + 0x66608881UL,0x9FFE2AA8UL,0x2E006800UL,0x09601C80UL,0x82CE06E8UL,
11.138 + 0x689F61D4UL,0x9CAE2E68UL,0xEEE1697CUL,0xB5564CC8UL,0x4600F7FEUL,
11.139 + 0x15E03280UL,0x84260F88UL,0x094BE31AUL,0xB2C646F7UL,0x879DF5D2UL,
11.140 + 0xF99EA229UL,0xB1FE42A8UL,0x27607480UL,0x8BAE1A68UL,0xEA51673CUL,
11.141 + 0xF4314FBCUL,0x724F4714UL,0x5BB725B4UL,0xF356BB36UL,0x53E0C57EUL,
11.142 + 0x91C63D08UL,0x8D6DEC92UL,0xBB8DA5EDUL,0x355BB325UL,0x7E0357FBUL,
11.143 + 0x4860E081UL,0x969E3628UL,0xACCE6EE8UL,0x61FF7D54UL,0x1E602880UL,
11.144 + 0x867E08A8UL,0x29F862A0UL,0xA8E19E82UL,0xA0B67E48UL,0xC226F876UL,
11.145 + 0x1CABD19AUL,0x36E0497FUL,0x8ED616C8UL,0x4B58E4DEUL,0x3663B77AUL,
11.146 + 0xDEFED6A9UL,0x3A5058C0UL,0xCD3113BCUL,0x7F9F55D4UL,0x981E2028UL,
11.147 + 0xAF866A08UL,0x8119FC22UL,0x0857E0CAUL,0x6290863EUL,0xDE8D29ECUL,
11.148 + 0x2A4B98E5UL,0xB8365FB7UL,0xC58EF216UL,0x7D3B53A4UL,0xE89D61D3UL,
11.149 + 0xE4AE8E69UL,0xF7614B7CUL,0xB2AE4668UL,0xE78175FCUL,0x37984A20UL,
11.150 + 0x2E9F962AUL,0x894E1CE8UL,0x6AC766F4UL,0xBC1DAFD2UL,0xF4C6B109UL,
11.151 + 0x927DC752UL,0x7DB8ADA1UL,0xB8B5A1B2UL,0x95A63277UL,0x0C33EFBAUL,
11.152 + 0x13CFC515UL,0x45CF0D14UL,0x552F3394UL,0xD0193FDCUL,0x1907DC0AUL,
11.153 + 0xA7D18AC2UL,0xE3897A1CUL,0xD6DAC926UL,0x48DB1EDBUL,0x66BB765BUL,
11.154 + 0xEFC56AF3UL,0xC50D0C13UL,0x2D1393C5UL,0x9995DDCDUL,0x1FFC2AAFUL,
11.155 + 0x5600C801UL,0x10E03E80UL,0x85360C48UL,0xC91EE3D6UL,0xBED656C8UL,
11.156 + 0x4458F0DEUL,0x3553B33AUL,0x9E01D7FDUL,0x2E606880UL,0x897E1CA8UL,
11.157 + 0x2AC866E0UL,0xE81E9FD6UL,0xB4864E08UL,0x8669F762UL,0x49FCE2AEUL,
11.158 + 0x46E0F681UL,0x95D632C8UL,0x4C28EF9EUL,0x77C8B51EUL,0xFA8EA616UL,
11.159 + 0x710B43E4UL,0xAB5264C7UL,0xB061BF7DUL,0xA71E7428UL,0xA3B67A48UL,
11.160 + 0xC2D6F936UL,0x5C98D1DEUL,0x32EFB96AUL,0xCF9515CCUL,0x0F1C142FUL,
11.161 + 0xD336C449UL,0xD9FEDD56UL,0x3BE05A80UL,0x8D461308UL,0x8B85E5F2UL,
11.162 + 0xDA592723UL,0x1B33DBBAUL,0x177FCB55UL,0x04A80E60UL,0x6160837EUL,
11.163 + 0x9E4E28E8UL,0x6E7768B4UL,0xFD7AACA6UL,0xC08901E3UL,0xDC2AD066UL,
11.164 + 0x0AC8191FUL,0xE21E87D6UL,0xB6A64988UL,0x06C3F6FAUL,0x51DCC2D1UL,
11.165 + 0xC16AFC99UL,0x0C4C10EFUL,0x13D7C535UL,0x65C88D1EUL,0xFF2EAB96UL,
11.166 + 0xF039405CUL,0x930DC412UL,0x3DF3AD45UL,0x1CA3D185UL,0xD6E2C979UL,
11.167 + 0xE8D69EC9UL,0x54B8CE5EUL,0xB065BF72UL,0x571F342BUL,0x90B63E48UL,
11.168 + 0xCD26EC76UL,0x1F9BD5DAUL,0x761F482BUL,0x9AE62688UL,0x0F17EBCAUL,
11.169 + 0x6334844EUL,0xAEFE6957UL,0x21507CC0UL,0xCA4118FCUL,0x3E3457B0UL,
11.170 + 0xBC6E5097UL,0xE4DD712CUL,0xE77A8B59UL,0xC7A90A63UL,0x5D90D23EUL,
11.171 + 0xD2BD39ACUL,0x69849DF1UL,0xECF96EA3UL,0x95F1CD42UL,0x6C236F84UL,
11.172 + 0xCDCAED19UL,0x8FAE1597UL,0xEB11643CUL,0xF4754F4CUL,0x825A0727UL,
11.173 + 0x58B321BBUL,0x03A7FA75UL,0x20D3813AUL,0x9A39D85DUL,0x8F2DEB92UL,
11.174 + 0xBB39A45DUL,0x857DF352UL,0x7908A3E1UL,0xF9D2A2C6UL,0xA1E9829DUL,
11.175 + 0x4264F88EUL,0x64BF71ABUL,0x1F642B70UL,0x762F486BUL,0xDAE9269CUL,
11.176 + 0x5B14DBCEUL,0x23747B4FUL,0xBAEA5967UL,0x151433CFUL,0x34144FCFUL,
11.177 + 0x3E44570FUL,0xFC7550B3UL,0x80DA0127UL,0x583B205BUL,0xE38D7A13UL,
11.178 + 0x26DB8925UL,0x7BDB5ADBUL,0x694B631BUL,0xACC66EF7UL,0x81FDFD52UL,
11.179 + 0x7860A081UL,0x999E2228UL,0xAFFE6AA8UL,0x21007C00UL,0x0A5018C0UL,
11.180 + 0xC23107BCUL,0x7CAF5194UL,0xD8E1217CUL,0xBBB65A48UL,0xC556F336UL,
11.181 + 0x5D00D3FEUL,0x129039C0UL,0xC58D0DECUL,0x2D3B93A5UL,0xF99D5DD3UL,
11.182 + 0xE1FE82A9UL,0x36604880UL,0x8EFE16A8UL,0x2B5064C0UL,0xC8611F7CUL,
11.183 + 0xBE9E5628UL,0xA44E70E8UL,0x63577B34UL,0x7EE0A97EUL,0x985620C8UL,
11.184 + 0x4F90EA3EUL,0xD71D342CUL,0xE8B69E49UL,0xD4A6CE76UL,0x1863DF7AUL,
11.185 + 0xD79ECA29UL,0xB89E5E28UL,0xA5AE7268UL,0xE3317BBCUL,0x76FF4954UL,
11.186 + 0x1AD026C0UL,0xC7190BDCUL,0x1DB7D24AUL,0xE6B689B6UL,0xD7C6CAF6UL,
11.187 + 0x988DDE12UL,0x3FABAA65UL,0x3C10503FUL,0xCCC5110CUL,0xCFFD1553UL,
11.188 + 0x6F009401UL,0x1D302C40UL,0x469F09D4UL,0x95CE32E8UL,0x6C2F6F94UL,
11.189 + 0xDDC92D1CUL,0xDAAED996UL,0xFB015BFCUL,0x31704340UL,0x4F4B14E4UL,
11.190 + 0xA7267477UL,0x03BBFA5AUL,0xF0D54133UL,0x0338045FUL,0xA0FD8152UL,
11.191 + 0x7230B841UL,0x5BAF2594UL,0xD3513B3CUL,0xF9E15D7CUL,0xB1E64288UL,
11.192 + 0x0767F48AUL,0x21AF826AUL,0xCA7118BCUL,0x7E3B57A4UL,0xE86D6093UL,
11.193 + 0xA49D8E2DUL,0xF36EBB69UL,0xF3ED456CUL,0xA3C5850DUL,0xD2CD3913UL,
11.194 + 0x299F9DD5UL,0x88FE1EA8UL,0x2AB06640UL,0x48071FF4UL,0xB681B602UL,
11.195 + 0x26C876E0UL,0xEBDE9AD6UL,0xB44A4F18UL,0x96563737UL,0x4CF0EEBEUL,
11.196 + 0x57F33544UL,0x0083FE05UL,0x5028C061UL,0x7108BC1EUL,0xFB52A4C6UL,
11.197 + 0xA161837DUL,0xA24E78E8UL,0x62B779B4UL,0xFE86A9F6UL,0x9049C0E2UL,
11.198 + 0xCD16EC36UL,0x5F94D5CEUL,0x221C782FUL,0xDAA6D989UL,0x1B03DBFAUL,
11.199 + 0x5770CB41UL,0x50AB3E64UL,0x21207C7FUL,0x8A5A18D8UL,0x5A3327BBUL,
11.200 + 0x032FFB95UL,0xC0F9015CUL,0x9C31D042UL,0x6ECF6914UL,0x5D5F2CD4UL,
11.201 + 0x928239F8UL,0x7D88ADE1UL,0xF8BAA1A6UL,0xC1A50273UL,0x4C7310BBUL,
11.202 + 0x07DBF525UL,0x718B421BUL,0xAB7A64A7UL,0xD0693F63UL,0x591CDC2EUL,
11.203 + 0xC3D6FAC9UL,0x5CC8D11EUL,0xF2FEB956UL,0x339045C0UL,0xCFDD152CUL,
11.204 + 0xEF0A9419UL,0x85320C47UL,0x391FA3D5UL,0x8DD612C8UL,0x4BA8E59EUL,
11.205 + 0x7650B73EUL,0xDAF126BCUL,0x7B135BC4UL,0x8975E34DUL,0x9ACA26E7UL,
11.206 + 0x9F1E2BD7UL,0xAE366848UL,0xC16EFC96UL,0xFC4D50ECUL,0x20D78135UL,
11.207 + 0x6A38985EUL,0xBC2DAF92UL,0xB4C9B11DUL,0xC67EF756UL,0x3DF852A0UL,
11.208 + 0xACA19182UL,0xA1E27D78UL,0xF266B889UL,0x13BFC5AAUL,0x05D40D30UL,
11.209 + 0x3128439FUL,0x6F5894DEUL,0x3D23AC7AUL,0xDC9AD1D9UL,0x4AEF196BUL,
11.210 + 0xD61537CCUL,0x08E41E8FUL,0x72B7464BUL,0xFB86A5F6UL,0x9159C322UL,
11.211 + 0x0D43ECFAUL,0x5384C5F1UL,0xE1D97D23UL,0x166BC89AUL,0x34FC4EAFUL,
11.212 + 0x5E70D741UL,0x527B38A4UL,0xE1B97DA3UL,0x9675C8B2UL,0x9CFA2EA7UL,
11.213 + 0xDEF12943UL,0x7A5358C4UL,0x8931E3BDUL,0x6ADF66D4UL,0x9C1A2FD8UL,
11.214 + 0x5EC7290BUL,0xB25DB8D2UL,0xF7B2B5B9UL,0x22978635UL,0x6A8C99EEUL,
11.215 + 0x0C0BEFE5UL,0xB3C24507UL,0x77CCB511UL,0x0A8FE615UL,0x420B07E4UL,
11.216 + 0xA4A27187UL,0xF362BB79UL,0xE3EE8569UL,0xF6C5490CUL,0xC2DD06D3UL,
11.217 + 0xEC9A91D9UL,0x45EF0D6BUL,0xD525338CUL,0x481B1FDBUL,0x6687760BUL,
11.218 + 0xBFC9AAE2UL,0xC40EF016UL,0x7D435304UL,0x4884E1F1UL,0xE6A97663UL,
11.219 + 0x57C0CAFEUL,0x108C3E10UL,0x152BCC65UL,0x34184FDFUL,0x2E47970AUL,
11.220 + 0xA9759CB2UL,0x90CA3EE7UL,0x9D3E2C57UL,0x2E9C69D0UL,0xD94EDCE9UL,
11.221 + 0x7BC75AF4UL,0xB94DA312UL,0x35C7B2F5UL,0xAE2D9792UL,0xB169BC9DUL,
11.222 + 0x474CF4EEUL,0x05A7F275UL,0x213383BAUL,0x1A5FD8D5UL,0x87320BB8UL,
11.223 + 0x39BFA255UL,0x0DF412B0UL,0xB3A24587UL,0xF7D2B539UL,0xA289861DUL,
11.224 + 0xC28AF9E6UL,0x8C8A11E7UL,0x9BEA2567UL,0x1F442B0FUL,0xF6254873UL,
11.225 + 0x42EB069BUL,0x249471CFUL,0x3B6C5B6FUL,0x9D6DD36DUL,0xBE8DA9EDUL,
11.226 + 0x344BB0E5UL,0xBE565737UL,0x4470F0BEUL,0x555B3324UL,0x60037FFBUL,
11.227 + 0x4E00E801UL,0x17603480UL,0x84AE0E68UL,0xE961637CUL,0xB4CE4EE8UL,
11.228 + 0x667F7754UL,0x1FF82AA0UL,0xA6018802UL,0x23E07A80UL,0x8AC61908UL,
11.229 + 0x8A1DE7D2UL,0xFA26A789UL,0x112BC39AUL,0x35584CDFUL,0x2E0397FAUL,
11.230 + 0x5960DC81UL,0x93CE3AE8UL,0x6DCF6D14UL,0x5DAF2D94UL,0xD2B139BCUL,
11.231 + 0x79875DF4UL,0xB9F9A2A2UL,0x85E1F282UL,0xA9266388UL,0x00DBFEDAUL,
11.232 + 0x703B405BUL,0xEB0D6413UL,0x24738F45UL,0x1B5BDB25UL,0x77634B7BUL,
11.233 + 0xCAAEE669UL,0xFE0157FCUL,0x30604080UL,0x8F1E1428UL,0xAB366448UL,
11.234 + 0xC07EFF56UL,0x3C185020UL,0x2CC7910AUL,0xA9FD9D52UL,0x70E0BE81UL,
11.235 + 0x9B362448UL,0xCF7EEB56UL,0x3F285460UL,0x6C38905EUL,0xBDCDAD12UL,
11.236 + 0x34AFB195UL,0xCE61177CUL,0xBF7E54A8UL,0x24287060UL,0x6B489B1EUL,
11.237 + 0xFC66AF76UL,0x10DFC12AUL,0x853A0C58UL,0xD91D23D3UL,0xEBD69AC9UL,
11.238 + 0x5448CF1EUL,0xF056BF36UL,0x5310C43EUL,0xD1F53D4CUL,0x89621C87UL,
11.239 + 0xFACEA6E9UL,0x711F43D4UL,0x9B5624C8UL,0x4F60EB7EUL,0x972E3468UL,
11.240 + 0xECB96E5CUL,0x95E5CD72UL,0x5C272F8BUL,0x32CBB91AUL,0xBF9E55D7UL,
11.241 + 0xA41E7028UL,0xA3467B08UL,0x82E5F972UL,0x589721CBUL,0x73ACBA6EUL,
11.242 + 0x8BD1E53DUL,0xEA49671CUL,0xD436CFB6UL,0xD84EDF16UL,0x7B975A34UL,
11.243 + 0x795CA32EUL,0xC9C2E2F9UL,0x6EEC9691UL,0x8D55ECCDUL,0x1B8025FFUL,
11.244 + 0x07580B20UL,0x21A3827AUL,0xDA72D8B9UL,0x2B3B9BA5UL,0xF87D5F53UL,
11.245 + 0x61988221UL,0x3E7FA8AAUL,0x0C7810A0UL,0xA3D98522UL,0x02CBF91AUL,
11.246 + 0xB09E41D7UL,0xA72E7468UL,0xE3B97A5CUL,0x96D5C932UL,0x1CD82EDFUL,
11.247 + 0x26FB895AUL,0xFBD15AC3UL,0xF149431CUL,0xD346C4F6UL,0x99E5DD72UL,
11.248 +
11.249 +};
11.250 +# endif
11.251 +# if defined WORDS_BIGENDIAN
11.252 +/* big endian */
11.253 +static const uint32_t yellowbook_scrambler_uint32[2340/4] = {
11.254 + 0x01800060UL,0x0028001EUL,0x80086006UL,0xA802FE81UL,0x80606028UL,
11.255 + 0x281E9E88UL,0x6866AEAAUL,0xFC7F01E0UL,0x00480036UL,0x8016E00EUL,
11.256 + 0xC8045683UL,0x7EE1E048UL,0x4836B696UL,0xF6EEC6CCUL,0x52D5FD9FUL,
11.257 + 0x01A8007EUL,0x80206018UL,0x280A9E87UL,0x28629EA9UL,0xA87EFEA0UL,
11.258 + 0x40783022UL,0x9419AF4AUL,0xFC3701D6UL,0x805EE038UL,0x4812B68DUL,
11.259 + 0xB6E5B6CBUL,0x36D756DEUL,0xBED8705AUL,0xA43B3B53UL,0x537DFDE1UL,
11.260 + 0x81886066UL,0xA82AFE9FUL,0x0068002EUL,0x801C6009UL,0xE806CE82UL,
11.261 + 0xD4619F68UL,0x682EAE9CUL,0x7C69E1EEUL,0xC84C56B5UL,0xFEF70046UL,
11.262 + 0x8032E015UL,0x880F2684UL,0x1AE34B09UL,0xF746C6B2UL,0xD2F59D87UL,
11.263 + 0x29A29EF9UL,0xA842FEB1UL,0x80746027UL,0x681AAE8BUL,0x3C6751EAUL,
11.264 + 0xBC4F31F4UL,0x14474F72UL,0xB425B75BUL,0x36BB56F3UL,0x7EC5E053UL,
11.265 + 0x083DC691UL,0x92EC6D8DUL,0xEDA58DBBUL,0x25B35B35UL,0xFB57037EUL,
11.266 + 0x81E06048UL,0x28369E96UL,0xE86ECEACUL,0x547DFF61UL,0x8028601EUL,
11.267 + 0xA8087E86UL,0xA062F829UL,0x829EE1A8UL,0x487EB6A0UL,0x76F826C2UL,
11.268 + 0x9AD1AB1CUL,0x7F49E036UL,0xC816D68EUL,0xDEE4584BUL,0x7AB76336UL,
11.269 + 0xA9D6FEDEUL,0xC058503AUL,0xBC1331CDUL,0xD4559F7FUL,0x28201E98UL,
11.270 + 0x086A86AFUL,0x22FC1981UL,0xCAE05708UL,0x3E869062UL,0xEC298DDEUL,
11.271 + 0xE5984B2AUL,0xB75F36B8UL,0x16F28EC5UL,0xA4533B7DUL,0xD3619DE8UL,
11.272 + 0x698EAEE4UL,0x7C4B61F7UL,0x6846AEB2UL,0xFC7581E7UL,0x204A9837UL,
11.273 + 0x2A969F2EUL,0xE81C4E89UL,0xF466C76AUL,0xD2AF1DBCUL,0x09B1C6F4UL,
11.274 + 0x52C77D92UL,0xA1ADB87DUL,0xB2A1B5B8UL,0x7732A695UL,0xBAEF330CUL,
11.275 + 0x15C5CF13UL,0x140DCF45UL,0x94332F55UL,0xDC3F19D0UL,0x0ADC0719UL,
11.276 + 0xC28AD1A7UL,0x1C7A89E3UL,0x26C9DAD6UL,0xDB1EDB48UL,0x5B76BB66UL,
11.277 + 0xF36AC5EFUL,0x130C0DC5UL,0xC593132DUL,0xCDDD9599UL,0xAF2AFC1FUL,
11.278 + 0x01C80056UL,0x803EE010UL,0x480C3685UL,0xD6E31EC9UL,0xC856D6BEUL,
11.279 + 0xDEF05844UL,0x3AB35335UL,0xFDD7019EUL,0x8068602EUL,0xA81C7E89UL,
11.280 + 0xE066C82AUL,0xD69F1EE8UL,0x084E86B4UL,0x62F76986UL,0xAEE2FC49UL,
11.281 + 0x81F6E046UL,0xC832D695UL,0x9EEF284CUL,0x1EB5C877UL,0x16A68EFAUL,
11.282 + 0xE4430B71UL,0xC76452ABUL,0x7DBF61B0UL,0x28741EA7UL,0x487AB6A3UL,
11.283 + 0x36F9D6C2UL,0xDED1985CUL,0x6AB9EF32UL,0xCC1595CFUL,0x2F141C0FUL,
11.284 + 0x49C436D3UL,0x56DDFED9UL,0x805AE03BUL,0x0813468DUL,0xF2E5858BUL,
11.285 + 0x232759DAUL,0xBADB331BUL,0x55CB7F17UL,0x600EA804UL,0x7E836061UL,
11.286 + 0xE8284E9EUL,0xB468776EUL,0xA6AC7AFDUL,0xE30189C0UL,0x66D02ADCUL,
11.287 + 0x1F19C80AUL,0xD6871EE2UL,0x8849A6B6UL,0xFAF6C306UL,0xD1C2DC51UL,
11.288 + 0x99FC6AC1UL,0xEF104C0CUL,0x35C5D713UL,0x1E8DC865UL,0x96AB2EFFUL,
11.289 + 0x5C4039F0UL,0x12C40D93UL,0x45ADF33DUL,0x85D1A31CUL,0x79C9E2D6UL,
11.290 + 0xC99ED6E8UL,0x5ECEB854UL,0x72BF65B0UL,0x2B341F57UL,0x483EB690UL,
11.291 + 0x76EC26CDUL,0xDAD59B1FUL,0x2B481F76UL,0x8826E69AUL,0xCAEB170FUL,
11.292 + 0x4E843463UL,0x5769FEAEUL,0xC07C5021UL,0xFC1841CAUL,0xB057343EUL,
11.293 + 0x97506EBCUL,0x2C71DDE4UL,0x598B7AE7UL,0x630AA9C7UL,0x3ED2905DUL,
11.294 + 0xAC39BDD2UL,0xF19D8469UL,0xA36EF9ECUL,0x42CDF195UL,0x846F236CUL,
11.295 + 0x19EDCACDUL,0x9715AE8FUL,0x3C6411EBUL,0x4C4F75F4UL,0x27075A82UL,
11.296 + 0xBB21B358UL,0x75FAA703UL,0x3A81D320UL,0x5DD8399AUL,0x92EB2D8FUL,
11.297 + 0x5DA439BBUL,0x52F37D85UL,0xE1A30879UL,0xC6A2D2F9UL,0x9D82E9A1UL,
11.298 + 0x8EF86442UL,0xAB71BF64UL,0x702B641FUL,0x6B482F76UL,0x9C26E9DAUL,
11.299 + 0xCEDB145BUL,0x4F7B7423UL,0x6759EABAUL,0xCF331415UL,0xCF4F1434UL,
11.300 + 0x0F57443EUL,0xB35075FCUL,0x2701DA80UL,0x5B203B58UL,0x137A8DE3UL,
11.301 + 0x2589DB26UL,0xDB5ADB7BUL,0x1B634B69UL,0xF76EC6ACUL,0x52FDFD81UL,
11.302 + 0x81A06078UL,0x28229E99UL,0xA86AFEAFUL,0x007C0021UL,0xC018500AUL,
11.303 + 0xBC0731C2UL,0x9451AF7CUL,0x7C21E1D8UL,0x485AB6BBUL,0x36F356C5UL,
11.304 + 0xFED3005DUL,0xC0399012UL,0xEC0D8DC5UL,0xA5933B2DUL,0xD35D9DF9UL,
11.305 + 0xA982FEE1UL,0x80486036UL,0xA816FE8EUL,0xC064502BUL,0x7C1F61C8UL,
11.306 + 0x28569EBEUL,0xE8704EA4UL,0x347B5763UL,0x7EA9E07EUL,0xC8205698UL,
11.307 + 0x3EEA904FUL,0x2C341DD7UL,0x499EB6E8UL,0x76CEA6D4UL,0x7ADF6318UL,
11.308 + 0x29CA9ED7UL,0x285E9EB8UL,0x6872AEA5UL,0xBC7B31E3UL,0x5449FF76UL,
11.309 + 0xC026D01AUL,0xDC0B19C7UL,0x4AD2B71DUL,0xB689B6E6UL,0xF6CAC6D7UL,
11.310 + 0x12DE8D98UL,0x65AAAB3FUL,0x3F50103CUL,0x0C11C5CCUL,0x5315FDCFUL,
11.311 + 0x0194006FUL,0x402C301DUL,0xD4099F46UL,0xE832CE95UL,0x946F2F6CUL,
11.312 + 0x1C2DC9DDUL,0x96D9AEDAUL,0xFC5B01FBUL,0x40437031UL,0xE4144B4FUL,
11.313 + 0x777426A7UL,0x5AFABB03UL,0x3341D5F0UL,0x5F043803UL,0x5281FDA0UL,
11.314 + 0x41B83072UL,0x9425AF5BUL,0x3C3B51D3UL,0x7C5DE1F9UL,0x8842E6B1UL,
11.315 + 0x8AF46707UL,0x6A82AF21UL,0xBC1871CAUL,0xA4573B7EUL,0x93606DE8UL,
11.316 + 0x2D8E9DA4UL,0x69BB6EF3UL,0x6C45EDF3UL,0x0D85C5A3UL,0x1339CDD2UL,
11.317 + 0xD59D9F29UL,0xA81EFE88UL,0x4066B02AUL,0xF41F0748UL,0x02B681B6UL,
11.318 + 0xE076C826UL,0xD69ADEEBUL,0x184F4AB4UL,0x37375696UL,0xBEEEF04CUL,
11.319 + 0x4435F357UL,0x05FE8300UL,0x61C02850UL,0x1EBC0871UL,0xC6A452FBUL,
11.320 + 0x7D8361A1UL,0xE8784EA2UL,0xB479B762UL,0xF6A986FEUL,0xE2C04990UL,
11.321 + 0x36EC16CDUL,0xCED5945FUL,0x2F781C22UL,0x89D9A6DAUL,0xFADB031BUL,
11.322 + 0x41CB7057UL,0x643EAB50UL,0x7F7C2021UL,0xD8185A8AUL,0xBB27335AUL,
11.323 + 0x95FB2F03UL,0x5C01F9C0UL,0x42D0319CUL,0x1469CF6EUL,0xD42C5F5DUL,
11.324 + 0xF8398292UL,0xE1AD887DUL,0xA6A1BAF8UL,0x7302A5C1UL,0xBB10734CUL,
11.325 + 0x25F5DB07UL,0x1B428B71UL,0xA7647AABUL,0x633F69D0UL,0x2EDC1C59UL,
11.326 + 0xC9FAD6C3UL,0x1ED1C85CUL,0x56B9FEF2UL,0xC0459033UL,0x2C15DDCFUL,
11.327 + 0x19940AEFUL,0x470C3285UL,0xD5A31F39UL,0xC812D68DUL,0x9EE5A84BUL,
11.328 + 0x3EB75076UL,0xBC26F1DAUL,0xC45B137BUL,0x4DE37589UL,0xE726CA9AUL,
11.329 + 0xD72B1E9FUL,0x486836AEUL,0x96FC6EC1UL,0xEC504DFCUL,0x3581D720UL,
11.330 + 0x5E98386AUL,0x92AF2DBCUL,0x1DB1C9B4UL,0x56F77EC6UL,0xA052F83DUL,
11.331 + 0x8291A1ACUL,0x787DE2A1UL,0x89B866F2UL,0xAAC5BF13UL,0x300DD405UL,
11.332 + 0x9F432831UL,0xDE94586FUL,0x7AAC233DUL,0xD9D19ADCUL,0x6B19EF4AUL,
11.333 + 0xCC3715D6UL,0x8F1EE408UL,0x4B46B772UL,0xF6A586FBUL,0x22C35991UL,
11.334 + 0xFAEC430DUL,0xF1C58453UL,0x237DD9E1UL,0x9AC86B16UL,0xAF4EFC34UL,
11.335 + 0x41D7705EUL,0xA4387B52UL,0xA37DB9E1UL,0xB2C87596UL,0xA72EFA9CUL,
11.336 + 0x4329F1DEUL,0xC458537AUL,0xBDE33189UL,0xD466DF6AUL,0xD82F1A9CUL,
11.337 + 0x0B29C75EUL,0xD2B85DB2UL,0xB9B5B2F7UL,0x35869722UL,0xEE998C6AUL,
11.338 + 0xE5EF0B0CUL,0x0745C2B3UL,0x11B5CC77UL,0x15E68F0AUL,0xE4070B42UL,
11.339 + 0x8771A2A4UL,0x79BB62F3UL,0x6985EEE3UL,0x0C49C5F6UL,0xD306DDC2UL,
11.340 + 0xD9919AECUL,0x6B0DEF45UL,0x8C3325D5UL,0xDB1F1B48UL,0x0B768766UL,
11.341 + 0xE2AAC9BFUL,0x16F00EC4UL,0x0453437DUL,0xF1E18448UL,0x6376A9E6UL,
11.342 + 0xFECAC057UL,0x103E8C10UL,0x65CC2B15UL,0xDF4F1834UL,0x0A97472EUL,
11.343 + 0xB29C75A9UL,0xE73ECA90UL,0x572C3E9DUL,0xD0699C2EUL,0xE9DC4ED9UL,
11.344 + 0xF45AC77BUL,0x12A34DB9UL,0xF5B2C735UL,0x92972DAEUL,0x9DBC69B1UL,
11.345 + 0xEEF44C47UL,0x75F2A705UL,0xBA833321UL,0xD5D85F1AUL,0xB80B3287UL,
11.346 + 0x55A2BF39UL,0xB012F40DUL,0x8745A2B3UL,0x39B5D2F7UL,0x1D8689A2UL,
11.347 + 0xE6F98AC2UL,0xE7118A8CUL,0x6725EA9BUL,0x0F2B441FUL,0x734825F6UL,
11.348 + 0x9B06EB42UL,0xCF719424UL,0x6F5B6C3BUL,0x6DD36D9DUL,0xEDA98DBEUL,
11.349 + 0xE5B04B34UL,0x375756BEUL,0xBEF07044UL,0x24335B55UL,0xFB7F0360UL,
11.350 + 0x01E8004EUL,0x80346017UL,0x680EAE84UL,0x7C6361E9UL,0xE84ECEB4UL,
11.351 + 0x54777F66UL,0xA02AF81FUL,0x028801A6UL,0x807AE023UL,0x0819C68AUL,
11.352 + 0xD2E71D8AUL,0x89A726FAUL,0x9AC32B11UL,0xDF4C5835UL,0xFA97032EUL,
11.353 + 0x81DC6059UL,0xE83ACE93UL,0x146DCF6DUL,0x942DAF5DUL,0xBC39B1D2UL,
11.354 + 0xF45D8779UL,0xA2A2F9B9UL,0x82F2E185UL,0x886326A9UL,0xDAFEDB00UL,
11.355 + 0x5B403B70UL,0x13640DEBUL,0x458F7324UL,0x25DB5B1BUL,0x7B4B6377UL,
11.356 + 0x69E6AECAUL,0xFC5701FEUL,0x80406030UL,0x28141E8FUL,0x486436ABUL,
11.357 + 0x56FF7EC0UL,0x2050183CUL,0x0A91C72CUL,0x529DFDA9UL,0x81BEE070UL,
11.358 + 0x4824369BUL,0x56EB7ECFUL,0x6054283FUL,0x5E90386CUL,0x12ADCDBDUL,
11.359 + 0x95B1AF34UL,0x7C1761CEUL,0xA8547EBFUL,0x60702824UL,0x1E9B486BUL,
11.360 + 0x76AF66FCUL,0x2AC1DF10UL,0x580C3A85UL,0xD3231DD9UL,0xC99AD6EBUL,
11.361 + 0x1ECF4854UL,0x36BF56F0UL,0x3EC41053UL,0x4C3DF5D1UL,0x871C6289UL,
11.362 + 0xE9A6CEFAUL,0xD4431F71UL,0xC824569BUL,0x7EEB604FUL,0x68342E97UL,
11.363 + 0x5C6EB9ECUL,0x72CDE595UL,0x8B2F275CUL,0x1AB9CB32UL,0xD7559EBFUL,
11.364 + 0x28701EA4UL,0x087B46A3UL,0x72F9E582UL,0xCB219758UL,0x6EBAAC73UL,
11.365 + 0x3DE5D18BUL,0x1C6749EAUL,0xB6CF36D4UL,0x16DF4ED8UL,0x345A977BUL,
11.366 + 0x2EA35C79UL,0xF9E2C2C9UL,0x9196EC6EUL,0xCDEC558DUL,0xFF25801BUL,
11.367 + 0x200B5807UL,0x7A82A321UL,0xB9D872DAUL,0xA59B3B2BUL,0x535F7DF8UL,
11.368 + 0x21829861UL,0xAAA87F3EUL,0xA010780CUL,0x2285D9A3UL,0x1AF9CB02UL,
11.369 + 0xD7419EB0UL,0x68742EA7UL,0x5C7AB9E3UL,0x32C9D596UL,0xDF2ED81CUL,
11.370 + 0x5A89FB26UL,0xC35AD1FBUL,0x1C4349F1UL,0xF6C446D3UL,0x72DDE599UL,
11.371 +
11.372 +};
11.373 +# endif
11.374 +
11.375 +#else /* PROTOTYPES */
11.376 +
11.377 +# if !defined WORDS_BIGENDIAN
11.378 +/* little endian */
11.379 +static const uint32_t yellowbook_scrambler_uint32[2340/4] = {
11.380 + 0x60008001,0x1E002800,0x06600880,0x81FE02A8,0x28606080,
11.381 + 0x889E1E28,0xAAAE6668,0xE0017FFC,0x36004800,0x0EE01680,
11.382 + 0x835604C8,0x48E0E17E,0x96B63648,0xCCC6EEF6,0x9FFDD552,
11.383 + 0x7E00A801,0x18602080,0x879E0A28,0xA99E6228,0xA0FE7EA8,
11.384 + 0x22307840,0x4AAF1994,0xD60137FC,0x38E05E80,0x8DB61248,
11.385 + 0xCBB6E5B6,0xDE56D736,0x5A70D8BE,0x533B3BA4,0xE1FD7D53,
11.386 + 0x66608881,0x9FFE2AA8,0x2E006800,0x09601C80,0x82CE06E8,
11.387 + 0x689F61D4,0x9CAE2E68,0xEEE1697C,0xB5564CC8,0x4600F7FE,
11.388 + 0x15E03280,0x84260F88,0x094BE31A,0xB2C646F7,0x879DF5D2,
11.389 + 0xF99EA229,0xB1FE42A8,0x27607480,0x8BAE1A68,0xEA51673C,
11.390 + 0xF4314FBC,0x724F4714,0x5BB725B4,0xF356BB36,0x53E0C57E,
11.391 + 0x91C63D08,0x8D6DEC92,0xBB8DA5ED,0x355BB325,0x7E0357FB,
11.392 + 0x4860E081,0x969E3628,0xACCE6EE8,0x61FF7D54,0x1E602880,
11.393 + 0x867E08A8,0x29F862A0,0xA8E19E82,0xA0B67E48,0xC226F876,
11.394 + 0x1CABD19A,0x36E0497F,0x8ED616C8,0x4B58E4DE,0x3663B77A,
11.395 + 0xDEFED6A9,0x3A5058C0,0xCD3113BC,0x7F9F55D4,0x981E2028,
11.396 + 0xAF866A08,0x8119FC22,0x0857E0CA,0x6290863E,0xDE8D29EC,
11.397 + 0x2A4B98E5,0xB8365FB7,0xC58EF216,0x7D3B53A4,0xE89D61D3,
11.398 + 0xE4AE8E69,0xF7614B7C,0xB2AE4668,0xE78175FC,0x37984A20,
11.399 + 0x2E9F962A,0x894E1CE8,0x6AC766F4,0xBC1DAFD2,0xF4C6B109,
11.400 + 0x927DC752,0x7DB8ADA1,0xB8B5A1B2,0x95A63277,0x0C33EFBA,
11.401 + 0x13CFC515,0x45CF0D14,0x552F3394,0xD0193FDC,0x1907DC0A,
11.402 + 0xA7D18AC2,0xE3897A1C,0xD6DAC926,0x48DB1EDB,0x66BB765B,
11.403 + 0xEFC56AF3,0xC50D0C13,0x2D1393C5,0x9995DDCD,0x1FFC2AAF,
11.404 + 0x5600C801,0x10E03E80,0x85360C48,0xC91EE3D6,0xBED656C8,
11.405 + 0x4458F0DE,0x3553B33A,0x9E01D7FD,0x2E606880,0x897E1CA8,
11.406 + 0x2AC866E0,0xE81E9FD6,0xB4864E08,0x8669F762,0x49FCE2AE,
11.407 + 0x46E0F681,0x95D632C8,0x4C28EF9E,0x77C8B51E,0xFA8EA616,
11.408 + 0x710B43E4,0xAB5264C7,0xB061BF7D,0xA71E7428,0xA3B67A48,
11.409 + 0xC2D6F936,0x5C98D1DE,0x32EFB96A,0xCF9515CC,0x0F1C142F,
11.410 + 0xD336C449,0xD9FEDD56,0x3BE05A80,0x8D461308,0x8B85E5F2,
11.411 + 0xDA592723,0x1B33DBBA,0x177FCB55,0x04A80E60,0x6160837E,
11.412 + 0x9E4E28E8,0x6E7768B4,0xFD7AACA6,0xC08901E3,0xDC2AD066,
11.413 + 0x0AC8191F,0xE21E87D6,0xB6A64988,0x06C3F6FA,0x51DCC2D1,
11.414 + 0xC16AFC99,0x0C4C10EF,0x13D7C535,0x65C88D1E,0xFF2EAB96,
11.415 + 0xF039405C,0x930DC412,0x3DF3AD45,0x1CA3D185,0xD6E2C979,
11.416 + 0xE8D69EC9,0x54B8CE5E,0xB065BF72,0x571F342B,0x90B63E48,
11.417 + 0xCD26EC76,0x1F9BD5DA,0x761F482B,0x9AE62688,0x0F17EBCA,
11.418 + 0x6334844E,0xAEFE6957,0x21507CC0,0xCA4118FC,0x3E3457B0,
11.419 + 0xBC6E5097,0xE4DD712C,0xE77A8B59,0xC7A90A63,0x5D90D23E,
11.420 + 0xD2BD39AC,0x69849DF1,0xECF96EA3,0x95F1CD42,0x6C236F84,
11.421 + 0xCDCAED19,0x8FAE1597,0xEB11643C,0xF4754F4C,0x825A0727,
11.422 + 0x58B321BB,0x03A7FA75,0x20D3813A,0x9A39D85D,0x8F2DEB92,
11.423 + 0xBB39A45D,0x857DF352,0x7908A3E1,0xF9D2A2C6,0xA1E9829D,
11.424 + 0x4264F88E,0x64BF71AB,0x1F642B70,0x762F486B,0xDAE9269C,
11.425 + 0x5B14DBCE,0x23747B4F,0xBAEA5967,0x151433CF,0x34144FCF,
11.426 + 0x3E44570F,0xFC7550B3,0x80DA0127,0x583B205B,0xE38D7A13,
11.427 + 0x26DB8925,0x7BDB5ADB,0x694B631B,0xACC66EF7,0x81FDFD52,
11.428 + 0x7860A081,0x999E2228,0xAFFE6AA8,0x21007C00,0x0A5018C0,
11.429 + 0xC23107BC,0x7CAF5194,0xD8E1217C,0xBBB65A48,0xC556F336,
11.430 + 0x5D00D3FE,0x129039C0,0xC58D0DEC,0x2D3B93A5,0xF99D5DD3,
11.431 + 0xE1FE82A9,0x36604880,0x8EFE16A8,0x2B5064C0,0xC8611F7C,
11.432 + 0xBE9E5628,0xA44E70E8,0x63577B34,0x7EE0A97E,0x985620C8,
11.433 + 0x4F90EA3E,0xD71D342C,0xE8B69E49,0xD4A6CE76,0x1863DF7A,
11.434 + 0xD79ECA29,0xB89E5E28,0xA5AE7268,0xE3317BBC,0x76FF4954,
11.435 + 0x1AD026C0,0xC7190BDC,0x1DB7D24A,0xE6B689B6,0xD7C6CAF6,
11.436 + 0x988DDE12,0x3FABAA65,0x3C10503F,0xCCC5110C,0xCFFD1553,
11.437 + 0x6F009401,0x1D302C40,0x469F09D4,0x95CE32E8,0x6C2F6F94,
11.438 + 0xDDC92D1C,0xDAAED996,0xFB015BFC,0x31704340,0x4F4B14E4,
11.439 + 0xA7267477,0x03BBFA5A,0xF0D54133,0x0338045F,0xA0FD8152,
11.440 + 0x7230B841,0x5BAF2594,0xD3513B3C,0xF9E15D7C,0xB1E64288,
11.441 + 0x0767F48A,0x21AF826A,0xCA7118BC,0x7E3B57A4,0xE86D6093,
11.442 + 0xA49D8E2D,0xF36EBB69,0xF3ED456C,0xA3C5850D,0xD2CD3913,
11.443 + 0x299F9DD5,0x88FE1EA8,0x2AB06640,0x48071FF4,0xB681B602,
11.444 + 0x26C876E0,0xEBDE9AD6,0xB44A4F18,0x96563737,0x4CF0EEBE,
11.445 + 0x57F33544,0x0083FE05,0x5028C061,0x7108BC1E,0xFB52A4C6,
11.446 + 0xA161837D,0xA24E78E8,0x62B779B4,0xFE86A9F6,0x9049C0E2,
11.447 + 0xCD16EC36,0x5F94D5CE,0x221C782F,0xDAA6D989,0x1B03DBFA,
11.448 + 0x5770CB41,0x50AB3E64,0x21207C7F,0x8A5A18D8,0x5A3327BB,
11.449 + 0x032FFB95,0xC0F9015C,0x9C31D042,0x6ECF6914,0x5D5F2CD4,
11.450 + 0x928239F8,0x7D88ADE1,0xF8BAA1A6,0xC1A50273,0x4C7310BB,
11.451 + 0x07DBF525,0x718B421B,0xAB7A64A7,0xD0693F63,0x591CDC2E,
11.452 + 0xC3D6FAC9,0x5CC8D11E,0xF2FEB956,0x339045C0,0xCFDD152C,
11.453 + 0xEF0A9419,0x85320C47,0x391FA3D5,0x8DD612C8,0x4BA8E59E,
11.454 + 0x7650B73E,0xDAF126BC,0x7B135BC4,0x8975E34D,0x9ACA26E7,
11.455 + 0x9F1E2BD7,0xAE366848,0xC16EFC96,0xFC4D50EC,0x20D78135,
11.456 + 0x6A38985E,0xBC2DAF92,0xB4C9B11D,0xC67EF756,0x3DF852A0,
11.457 + 0xACA19182,0xA1E27D78,0xF266B889,0x13BFC5AA,0x05D40D30,
11.458 + 0x3128439F,0x6F5894DE,0x3D23AC7A,0xDC9AD1D9,0x4AEF196B,
11.459 + 0xD61537CC,0x08E41E8F,0x72B7464B,0xFB86A5F6,0x9159C322,
11.460 + 0x0D43ECFA,0x5384C5F1,0xE1D97D23,0x166BC89A,0x34FC4EAF,
11.461 + 0x5E70D741,0x527B38A4,0xE1B97DA3,0x9675C8B2,0x9CFA2EA7,
11.462 + 0xDEF12943,0x7A5358C4,0x8931E3BD,0x6ADF66D4,0x9C1A2FD8,
11.463 + 0x5EC7290B,0xB25DB8D2,0xF7B2B5B9,0x22978635,0x6A8C99EE,
11.464 + 0x0C0BEFE5,0xB3C24507,0x77CCB511,0x0A8FE615,0x420B07E4,
11.465 + 0xA4A27187,0xF362BB79,0xE3EE8569,0xF6C5490C,0xC2DD06D3,
11.466 + 0xEC9A91D9,0x45EF0D6B,0xD525338C,0x481B1FDB,0x6687760B,
11.467 + 0xBFC9AAE2,0xC40EF016,0x7D435304,0x4884E1F1,0xE6A97663,
11.468 + 0x57C0CAFE,0x108C3E10,0x152BCC65,0x34184FDF,0x2E47970A,
11.469 + 0xA9759CB2,0x90CA3EE7,0x9D3E2C57,0x2E9C69D0,0xD94EDCE9,
11.470 + 0x7BC75AF4,0xB94DA312,0x35C7B2F5,0xAE2D9792,0xB169BC9D,
11.471 + 0x474CF4EE,0x05A7F275,0x213383BA,0x1A5FD8D5,0x87320BB8,
11.472 + 0x39BFA255,0x0DF412B0,0xB3A24587,0xF7D2B539,0xA289861D,
11.473 + 0xC28AF9E6,0x8C8A11E7,0x9BEA2567,0x1F442B0F,0xF6254873,
11.474 + 0x42EB069B,0x249471CF,0x3B6C5B6F,0x9D6DD36D,0xBE8DA9ED,
11.475 + 0x344BB0E5,0xBE565737,0x4470F0BE,0x555B3324,0x60037FFB,
11.476 + 0x4E00E801,0x17603480,0x84AE0E68,0xE961637C,0xB4CE4EE8,
11.477 + 0x667F7754,0x1FF82AA0,0xA6018802,0x23E07A80,0x8AC61908,
11.478 + 0x8A1DE7D2,0xFA26A789,0x112BC39A,0x35584CDF,0x2E0397FA,
11.479 + 0x5960DC81,0x93CE3AE8,0x6DCF6D14,0x5DAF2D94,0xD2B139BC,
11.480 + 0x79875DF4,0xB9F9A2A2,0x85E1F282,0xA9266388,0x00DBFEDA,
11.481 + 0x703B405B,0xEB0D6413,0x24738F45,0x1B5BDB25,0x77634B7B,
11.482 + 0xCAAEE669,0xFE0157FC,0x30604080,0x8F1E1428,0xAB366448,
11.483 + 0xC07EFF56,0x3C185020,0x2CC7910A,0xA9FD9D52,0x70E0BE81,
11.484 + 0x9B362448,0xCF7EEB56,0x3F285460,0x6C38905E,0xBDCDAD12,
11.485 + 0x34AFB195,0xCE61177C,0xBF7E54A8,0x24287060,0x6B489B1E,
11.486 + 0xFC66AF76,0x10DFC12A,0x853A0C58,0xD91D23D3,0xEBD69AC9,
11.487 + 0x5448CF1E,0xF056BF36,0x5310C43E,0xD1F53D4C,0x89621C87,
11.488 + 0xFACEA6E9,0x711F43D4,0x9B5624C8,0x4F60EB7E,0x972E3468,
11.489 + 0xECB96E5C,0x95E5CD72,0x5C272F8B,0x32CBB91A,0xBF9E55D7,
11.490 + 0xA41E7028,0xA3467B08,0x82E5F972,0x589721CB,0x73ACBA6E,
11.491 + 0x8BD1E53D,0xEA49671C,0xD436CFB6,0xD84EDF16,0x7B975A34,
11.492 + 0x795CA32E,0xC9C2E2F9,0x6EEC9691,0x8D55ECCD,0x1B8025FF,
11.493 + 0x07580B20,0x21A3827A,0xDA72D8B9,0x2B3B9BA5,0xF87D5F53,
11.494 + 0x61988221,0x3E7FA8AA,0x0C7810A0,0xA3D98522,0x02CBF91A,
11.495 + 0xB09E41D7,0xA72E7468,0xE3B97A5C,0x96D5C932,0x1CD82EDF,
11.496 + 0x26FB895A,0xFBD15AC3,0xF149431C,0xD346C4F6,0x99E5DD72,
11.497 +
11.498 +};
11.499 +# endif
11.500 +# if defined WORDS_BIGENDIAN
11.501 +/* big endian */
11.502 +static const uint32_t yellowbook_scrambler_uint32[2340/4] = {
11.503 + 0x01800060,0x0028001E,0x80086006,0xA802FE81,0x80606028,
11.504 + 0x281E9E88,0x6866AEAA,0xFC7F01E0,0x00480036,0x8016E00E,
11.505 + 0xC8045683,0x7EE1E048,0x4836B696,0xF6EEC6CC,0x52D5FD9F,
11.506 + 0x01A8007E,0x80206018,0x280A9E87,0x28629EA9,0xA87EFEA0,
11.507 + 0x40783022,0x9419AF4A,0xFC3701D6,0x805EE038,0x4812B68D,
11.508 + 0xB6E5B6CB,0x36D756DE,0xBED8705A,0xA43B3B53,0x537DFDE1,
11.509 + 0x81886066,0xA82AFE9F,0x0068002E,0x801C6009,0xE806CE82,
11.510 + 0xD4619F68,0x682EAE9C,0x7C69E1EE,0xC84C56B5,0xFEF70046,
11.511 + 0x8032E015,0x880F2684,0x1AE34B09,0xF746C6B2,0xD2F59D87,
11.512 + 0x29A29EF9,0xA842FEB1,0x80746027,0x681AAE8B,0x3C6751EA,
11.513 + 0xBC4F31F4,0x14474F72,0xB425B75B,0x36BB56F3,0x7EC5E053,
11.514 + 0x083DC691,0x92EC6D8D,0xEDA58DBB,0x25B35B35,0xFB57037E,
11.515 + 0x81E06048,0x28369E96,0xE86ECEAC,0x547DFF61,0x8028601E,
11.516 + 0xA8087E86,0xA062F829,0x829EE1A8,0x487EB6A0,0x76F826C2,
11.517 + 0x9AD1AB1C,0x7F49E036,0xC816D68E,0xDEE4584B,0x7AB76336,
11.518 + 0xA9D6FEDE,0xC058503A,0xBC1331CD,0xD4559F7F,0x28201E98,
11.519 + 0x086A86AF,0x22FC1981,0xCAE05708,0x3E869062,0xEC298DDE,
11.520 + 0xE5984B2A,0xB75F36B8,0x16F28EC5,0xA4533B7D,0xD3619DE8,
11.521 + 0x698EAEE4,0x7C4B61F7,0x6846AEB2,0xFC7581E7,0x204A9837,
11.522 + 0x2A969F2E,0xE81C4E89,0xF466C76A,0xD2AF1DBC,0x09B1C6F4,
11.523 + 0x52C77D92,0xA1ADB87D,0xB2A1B5B8,0x7732A695,0xBAEF330C,
11.524 + 0x15C5CF13,0x140DCF45,0x94332F55,0xDC3F19D0,0x0ADC0719,
11.525 + 0xC28AD1A7,0x1C7A89E3,0x26C9DAD6,0xDB1EDB48,0x5B76BB66,
11.526 + 0xF36AC5EF,0x130C0DC5,0xC593132D,0xCDDD9599,0xAF2AFC1F,
11.527 + 0x01C80056,0x803EE010,0x480C3685,0xD6E31EC9,0xC856D6BE,
11.528 + 0xDEF05844,0x3AB35335,0xFDD7019E,0x8068602E,0xA81C7E89,
11.529 + 0xE066C82A,0xD69F1EE8,0x084E86B4,0x62F76986,0xAEE2FC49,
11.530 + 0x81F6E046,0xC832D695,0x9EEF284C,0x1EB5C877,0x16A68EFA,
11.531 + 0xE4430B71,0xC76452AB,0x7DBF61B0,0x28741EA7,0x487AB6A3,
11.532 + 0x36F9D6C2,0xDED1985C,0x6AB9EF32,0xCC1595CF,0x2F141C0F,
11.533 + 0x49C436D3,0x56DDFED9,0x805AE03B,0x0813468D,0xF2E5858B,
11.534 + 0x232759DA,0xBADB331B,0x55CB7F17,0x600EA804,0x7E836061,
11.535 + 0xE8284E9E,0xB468776E,0xA6AC7AFD,0xE30189C0,0x66D02ADC,
11.536 + 0x1F19C80A,0xD6871EE2,0x8849A6B6,0xFAF6C306,0xD1C2DC51,
11.537 + 0x99FC6AC1,0xEF104C0C,0x35C5D713,0x1E8DC865,0x96AB2EFF,
11.538 + 0x5C4039F0,0x12C40D93,0x45ADF33D,0x85D1A31C,0x79C9E2D6,
11.539 + 0xC99ED6E8,0x5ECEB854,0x72BF65B0,0x2B341F57,0x483EB690,
11.540 + 0x76EC26CD,0xDAD59B1F,0x2B481F76,0x8826E69A,0xCAEB170F,
11.541 + 0x4E843463,0x5769FEAE,0xC07C5021,0xFC1841CA,0xB057343E,
11.542 + 0x97506EBC,0x2C71DDE4,0x598B7AE7,0x630AA9C7,0x3ED2905D,
11.543 + 0xAC39BDD2,0xF19D8469,0xA36EF9EC,0x42CDF195,0x846F236C,
11.544 + 0x19EDCACD,0x9715AE8F,0x3C6411EB,0x4C4F75F4,0x27075A82,
11.545 + 0xBB21B358,0x75FAA703,0x3A81D320,0x5DD8399A,0x92EB2D8F,
11.546 + 0x5DA439BB,0x52F37D85,0xE1A30879,0xC6A2D2F9,0x9D82E9A1,
11.547 + 0x8EF86442,0xAB71BF64,0x702B641F,0x6B482F76,0x9C26E9DA,
11.548 + 0xCEDB145B,0x4F7B7423,0x6759EABA,0xCF331415,0xCF4F1434,
11.549 + 0x0F57443E,0xB35075FC,0x2701DA80,0x5B203B58,0x137A8DE3,
11.550 + 0x2589DB26,0xDB5ADB7B,0x1B634B69,0xF76EC6AC,0x52FDFD81,
11.551 + 0x81A06078,0x28229E99,0xA86AFEAF,0x007C0021,0xC018500A,
11.552 + 0xBC0731C2,0x9451AF7C,0x7C21E1D8,0x485AB6BB,0x36F356C5,
11.553 + 0xFED3005D,0xC0399012,0xEC0D8DC5,0xA5933B2D,0xD35D9DF9,
11.554 + 0xA982FEE1,0x80486036,0xA816FE8E,0xC064502B,0x7C1F61C8,
11.555 + 0x28569EBE,0xE8704EA4,0x347B5763,0x7EA9E07E,0xC8205698,
11.556 + 0x3EEA904F,0x2C341DD7,0x499EB6E8,0x76CEA6D4,0x7ADF6318,
11.557 + 0x29CA9ED7,0x285E9EB8,0x6872AEA5,0xBC7B31E3,0x5449FF76,
11.558 + 0xC026D01A,0xDC0B19C7,0x4AD2B71D,0xB689B6E6,0xF6CAC6D7,
11.559 + 0x12DE8D98,0x65AAAB3F,0x3F50103C,0x0C11C5CC,0x5315FDCF,
11.560 + 0x0194006F,0x402C301D,0xD4099F46,0xE832CE95,0x946F2F6C,
11.561 + 0x1C2DC9DD,0x96D9AEDA,0xFC5B01FB,0x40437031,0xE4144B4F,
11.562 + 0x777426A7,0x5AFABB03,0x3341D5F0,0x5F043803,0x5281FDA0,
11.563 + 0x41B83072,0x9425AF5B,0x3C3B51D3,0x7C5DE1F9,0x8842E6B1,
11.564 + 0x8AF46707,0x6A82AF21,0xBC1871CA,0xA4573B7E,0x93606DE8,
11.565 + 0x2D8E9DA4,0x69BB6EF3,0x6C45EDF3,0x0D85C5A3,0x1339CDD2,
11.566 + 0xD59D9F29,0xA81EFE88,0x4066B02A,0xF41F0748,0x02B681B6,
11.567 + 0xE076C826,0xD69ADEEB,0x184F4AB4,0x37375696,0xBEEEF04C,
11.568 + 0x4435F357,0x05FE8300,0x61C02850,0x1EBC0871,0xC6A452FB,
11.569 + 0x7D8361A1,0xE8784EA2,0xB479B762,0xF6A986FE,0xE2C04990,
11.570 + 0x36EC16CD,0xCED5945F,0x2F781C22,0x89D9A6DA,0xFADB031B,
11.571 + 0x41CB7057,0x643EAB50,0x7F7C2021,0xD8185A8A,0xBB27335A,
11.572 + 0x95FB2F03,0x5C01F9C0,0x42D0319C,0x1469CF6E,0xD42C5F5D,
11.573 + 0xF8398292,0xE1AD887D,0xA6A1BAF8,0x7302A5C1,0xBB10734C,
11.574 + 0x25F5DB07,0x1B428B71,0xA7647AAB,0x633F69D0,0x2EDC1C59,
11.575 + 0xC9FAD6C3,0x1ED1C85C,0x56B9FEF2,0xC0459033,0x2C15DDCF,
11.576 + 0x19940AEF,0x470C3285,0xD5A31F39,0xC812D68D,0x9EE5A84B,
11.577 + 0x3EB75076,0xBC26F1DA,0xC45B137B,0x4DE37589,0xE726CA9A,
11.578 + 0xD72B1E9F,0x486836AE,0x96FC6EC1,0xEC504DFC,0x3581D720,
11.579 + 0x5E98386A,0x92AF2DBC,0x1DB1C9B4,0x56F77EC6,0xA052F83D,
11.580 + 0x8291A1AC,0x787DE2A1,0x89B866F2,0xAAC5BF13,0x300DD405,
11.581 + 0x9F432831,0xDE94586F,0x7AAC233D,0xD9D19ADC,0x6B19EF4A,
11.582 + 0xCC3715D6,0x8F1EE408,0x4B46B772,0xF6A586FB,0x22C35991,
11.583 + 0xFAEC430D,0xF1C58453,0x237DD9E1,0x9AC86B16,0xAF4EFC34,
11.584 + 0x41D7705E,0xA4387B52,0xA37DB9E1,0xB2C87596,0xA72EFA9C,
11.585 + 0x4329F1DE,0xC458537A,0xBDE33189,0xD466DF6A,0xD82F1A9C,
11.586 + 0x0B29C75E,0xD2B85DB2,0xB9B5B2F7,0x35869722,0xEE998C6A,
11.587 + 0xE5EF0B0C,0x0745C2B3,0x11B5CC77,0x15E68F0A,0xE4070B42,
11.588 + 0x8771A2A4,0x79BB62F3,0x6985EEE3,0x0C49C5F6,0xD306DDC2,
11.589 + 0xD9919AEC,0x6B0DEF45,0x8C3325D5,0xDB1F1B48,0x0B768766,
11.590 + 0xE2AAC9BF,0x16F00EC4,0x0453437D,0xF1E18448,0x6376A9E6,
11.591 + 0xFECAC057,0x103E8C10,0x65CC2B15,0xDF4F1834,0x0A97472E,
11.592 + 0xB29C75A9,0xE73ECA90,0x572C3E9D,0xD0699C2E,0xE9DC4ED9,
11.593 + 0xF45AC77B,0x12A34DB9,0xF5B2C735,0x92972DAE,0x9DBC69B1,
11.594 + 0xEEF44C47,0x75F2A705,0xBA833321,0xD5D85F1A,0xB80B3287,
11.595 + 0x55A2BF39,0xB012F40D,0x8745A2B3,0x39B5D2F7,0x1D8689A2,
11.596 + 0xE6F98AC2,0xE7118A8C,0x6725EA9B,0x0F2B441F,0x734825F6,
11.597 + 0x9B06EB42,0xCF719424,0x6F5B6C3B,0x6DD36D9D,0xEDA98DBE,
11.598 + 0xE5B04B34,0x375756BE,0xBEF07044,0x24335B55,0xFB7F0360,
11.599 + 0x01E8004E,0x80346017,0x680EAE84,0x7C6361E9,0xE84ECEB4,
11.600 + 0x54777F66,0xA02AF81F,0x028801A6,0x807AE023,0x0819C68A,
11.601 + 0xD2E71D8A,0x89A726FA,0x9AC32B11,0xDF4C5835,0xFA97032E,
11.602 + 0x81DC6059,0xE83ACE93,0x146DCF6D,0x942DAF5D,0xBC39B1D2,
11.603 + 0xF45D8779,0xA2A2F9B9,0x82F2E185,0x886326A9,0xDAFEDB00,
11.604 + 0x5B403B70,0x13640DEB,0x458F7324,0x25DB5B1B,0x7B4B6377,
11.605 + 0x69E6AECA,0xFC5701FE,0x80406030,0x28141E8F,0x486436AB,
11.606 + 0x56FF7EC0,0x2050183C,0x0A91C72C,0x529DFDA9,0x81BEE070,
11.607 + 0x4824369B,0x56EB7ECF,0x6054283F,0x5E90386C,0x12ADCDBD,
11.608 + 0x95B1AF34,0x7C1761CE,0xA8547EBF,0x60702824,0x1E9B486B,
11.609 + 0x76AF66FC,0x2AC1DF10,0x580C3A85,0xD3231DD9,0xC99AD6EB,
11.610 + 0x1ECF4854,0x36BF56F0,0x3EC41053,0x4C3DF5D1,0x871C6289,
11.611 + 0xE9A6CEFA,0xD4431F71,0xC824569B,0x7EEB604F,0x68342E97,
11.612 + 0x5C6EB9EC,0x72CDE595,0x8B2F275C,0x1AB9CB32,0xD7559EBF,
11.613 + 0x28701EA4,0x087B46A3,0x72F9E582,0xCB219758,0x6EBAAC73,
11.614 + 0x3DE5D18B,0x1C6749EA,0xB6CF36D4,0x16DF4ED8,0x345A977B,
11.615 + 0x2EA35C79,0xF9E2C2C9,0x9196EC6E,0xCDEC558D,0xFF25801B,
11.616 + 0x200B5807,0x7A82A321,0xB9D872DA,0xA59B3B2B,0x535F7DF8,
11.617 + 0x21829861,0xAAA87F3E,0xA010780C,0x2285D9A3,0x1AF9CB02,
11.618 + 0xD7419EB0,0x68742EA7,0x5C7AB9E3,0x32C9D596,0xDF2ED81C,
11.619 + 0x5A89FB26,0xC35AD1FB,0x1C4349F1,0xF6C446D3,0x72DDE599,
11.620 +
11.621 +};
11.622 +# endif
11.623 +
11.624 +#endif /* PROTOTYPES */
12.1 --- a/src/gdrom/gdi.c Tue Feb 26 01:10:48 2008 +0000
12.2 +++ b/src/gdrom/gdi.c Sun Mar 02 11:38:08 2008 +0000
12.3 @@ -114,8 +114,8 @@
12.4 /* Data track */
12.5 switch(size) {
12.6 case 2048: image->track[i].mode = GDROM_MODE1; break;
12.7 - case 2336: image->track[i].mode = GDROM_GD; break;
12.8 - case 2352: image->track[i].mode = GDROM_RAW; break;
12.9 + case 2336: image->track[i].mode = GDROM_SEMIRAW_MODE2; break;
12.10 + case 2352: image->track[i].mode = GDROM_RAW_XA; break;
12.11 default:
12.12 gdrom_image_destroy_no_close(disc);
12.13 g_free(dirname);
13.1 --- a/src/gdrom/gdimage.c Tue Feb 26 01:10:48 2008 +0000
13.2 +++ b/src/gdrom/gdimage.c Sun Mar 02 11:38:08 2008 +0000
13.3 @@ -16,10 +16,12 @@
13.4 * GNU General Public License for more details.
13.5 */
13.6
13.7 +#include <assert.h>
13.8 #include <netinet/in.h>
13.9
13.10 #include "gdrom/gdrom.h"
13.11 #include "gdrom/packet.h"
13.12 +#include "ecc.h"
13.13 #include "bootstrap.h"
13.14
13.15 static void gdrom_image_destroy( gdrom_disc_t disc );
13.16 @@ -30,10 +32,21 @@
13.17 static gdrom_error_t gdrom_image_read_position( gdrom_disc_t disc, uint32_t lba, unsigned char *buf );
13.18 static int gdrom_image_drive_status( gdrom_disc_t disc );
13.19
13.20 +static uint8_t gdrom_default_sync[12] = { 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0 };
13.21 +
13.22 +#define SECTOR_HEADER_SIZE 16
13.23 +#define SECTOR_SUBHEADER_SIZE 8
13.24 +
13.25 +/* Data offset (from start of raw sector) by sector mode */
13.26 +static int gdrom_data_offset[] = { 16, 16, 16, 24, 24, 0, 8, 0, 0 };
13.27 +
13.28 +
13.29 +
13.30 struct cdrom_sector_header {
13.31 uint8_t sync[12];
13.32 uint8_t msf[3];
13.33 uint8_t mode;
13.34 + uint8_t subhead[8]; // Mode-2 XA sectors only
13.35 };
13.36
13.37 /**
13.38 @@ -58,7 +71,7 @@
13.39 if( image == NULL ) {
13.40 return NULL;
13.41 }
13.42 - image->disc_type = IDE_DISC_CDROM;
13.43 + image->disc_type = IDE_DISC_CDROMXA;
13.44 image->file = f;
13.45 gdrom_disc_t disc = (gdrom_disc_t)image;
13.46 gdrom_image_init(disc);
13.47 @@ -132,7 +145,7 @@
13.48 * Read a block from an image file, handling negative file offsets
13.49 * with 0-fill.
13.50 */
13.51 -static void gdrom_read_block( unsigned char *buf, int file_offset, int length, FILE *f )
13.52 +static gboolean gdrom_read_block( unsigned char *buf, int file_offset, int length, FILE *f )
13.53 {
13.54 if( file_offset < 0 ) {
13.55 int size = -file_offset;
13.56 @@ -146,9 +159,88 @@
13.57 }
13.58 }
13.59 fseek( f, file_offset, SEEK_SET );
13.60 - fread( buf, length, 1, f );
13.61 + return fread( buf, length, 1, f ) == 1;
13.62 }
13.63
13.64 +static void gdrom_build_sector_header( unsigned char *buf, uint32_t lba,
13.65 + gdrom_track_mode_t sector_mode )
13.66 +{
13.67 + memcpy( buf, gdrom_default_sync, 12 );
13.68 + cd_build_address( buf, sector_mode, lba );
13.69 +}
13.70 +
13.71 +/**
13.72 + * Return TRUE if the given read mode + track modes are compatible,
13.73 + * otherwise FALSE.
13.74 + * @param track_mode one of the GDROM_MODE* constants
13.75 + * @param read_mode the READ_CD_MODE from the read request
13.76 + */
13.77 +static gboolean gdrom_is_compatible_read_mode( int track_mode, int read_mode )
13.78 +{
13.79 + switch( read_mode ) {
13.80 + case READ_CD_MODE_ANY:
13.81 + return TRUE;
13.82 + case READ_CD_MODE_CDDA:
13.83 + return track_mode == GDROM_CDDA;
13.84 + case READ_CD_MODE_1:
13.85 + return track_mode == GDROM_MODE1 || track_mode == GDROM_MODE2_FORM1;
13.86 + case READ_CD_MODE_2_FORM_1:
13.87 + return track_mode == GDROM_MODE1 || track_mode == GDROM_MODE2_FORM1;
13.88 + case READ_CD_MODE_2_FORM_2:
13.89 + return track_mode == GDROM_MODE2_FORM2;
13.90 + case READ_CD_MODE_2:
13.91 + return track_mode == GDROM_MODE2_FORMLESS;
13.92 + default:
13.93 + return FALSE;
13.94 + }
13.95 +}
13.96 +
13.97 +/**
13.98 + * Determine the start position in a raw sector, and the amount of data to read
13.99 + * in bytes, for a given combination of sector mode and read mode.
13.100 + */
13.101 +static void gdrom_get_read_bounds( int sector_mode, int read_mode, int *start, int *size )
13.102 +{
13.103 + if( READ_CD_RAW(read_mode) ) {
13.104 + // whole sector
13.105 + *start = 0;
13.106 + *size = 2352;
13.107 + } else {
13.108 + *size = 0;
13.109 + if( READ_CD_DATA(read_mode) ) {
13.110 + *start = gdrom_data_offset[sector_mode];
13.111 + *size = gdrom_sector_size[sector_mode];
13.112 + }
13.113 +
13.114 + if( READ_CD_SUBHEAD(read_mode) &&
13.115 + (sector_mode == GDROM_MODE2_FORM1 || sector_mode == GDROM_MODE2_FORM2) ) {
13.116 + *start = SECTOR_HEADER_SIZE;
13.117 + *size += SECTOR_SUBHEADER_SIZE;
13.118 + }
13.119 +
13.120 + if( READ_CD_HEADER(read_mode) ) {
13.121 + *size += SECTOR_HEADER_SIZE;
13.122 + *start = 0;
13.123 + }
13.124 +
13.125 + }
13.126 +}
13.127 +
13.128 +/**
13.129 + * Read a single sector from a disc image. If you thought this would be simple,
13.130 + * I have just one thing to say to you: Bwahahahahahahahah.
13.131 + *
13.132 + * Once we've decided that there's a real sector at the requested lba, there's
13.133 + * really two things we need to care about:
13.134 + * 1. Is the sector mode compatible with the requested read mode
13.135 + * 2. Which parts of the sector do we need to return?
13.136 + * (header/subhead/data/raw sector)
13.137 + *
13.138 + * Also note that the disc image may supply us with just the data (most common
13.139 + * case), or may have the full raw sector. In the former case we may need to
13.140 + * generate the missing data on the fly, for which we use libedc to compute the
13.141 + * data correction codes.
13.142 + */
13.143 static gdrom_error_t gdrom_image_read_sector( gdrom_disc_t disc, uint32_t lba,
13.144 int mode, unsigned char *buf, uint32_t *length )
13.145 {
13.146 @@ -171,47 +263,109 @@
13.147 f = image->file;
13.148 }
13.149
13.150 -
13.151 -
13.152 - switch( mode ) {
13.153 - case 0x20: /* Actually, read anything, but for now... */
13.154 - case 0x24:
13.155 - case 0x28:
13.156 - read_len = 2048;
13.157 - switch( track->mode ) {
13.158 - case GDROM_MODE1:
13.159 - case GDROM_MODE2_XA1:
13.160 - gdrom_read_block( buf, file_offset, track->sector_size, f );
13.161 - break;
13.162 - case GDROM_MODE2:
13.163 - file_offset += 8; /* skip the subheader */
13.164 - gdrom_read_block( buf, file_offset, 2048, f );
13.165 - break;
13.166 - case GDROM_RAW:
13.167 - gdrom_read_block( (unsigned char *)(&secthead), file_offset, sizeof(secthead), f );
13.168 - switch( secthead.mode ) {
13.169 - case 1:
13.170 - file_offset += 16;
13.171 - break;
13.172 - case 2:
13.173 - file_offset += 24;
13.174 - break;
13.175 - default:
13.176 - return PKT_ERR_BADREADMODE;
13.177 - }
13.178 - gdrom_read_block( buf, file_offset, 2048, f );
13.179 - break;
13.180 - default:
13.181 - return PKT_ERR_BADREADMODE;
13.182 + /* First figure out what the real sector mode is for raw/semiraw sectors */
13.183 + int sector_mode;
13.184 + switch( track->mode ) {
13.185 + case GDROM_RAW_NONXA:
13.186 + gdrom_read_block( (unsigned char *)(&secthead), file_offset, sizeof(secthead), f );
13.187 + sector_mode = (secthead.mode == 1) ? GDROM_MODE1 : GDROM_MODE2_FORMLESS;
13.188 + break;
13.189 + case GDROM_RAW_XA:
13.190 + gdrom_read_block( (unsigned char *)(&secthead), file_offset, sizeof(secthead), f );
13.191 + if( secthead.mode == 1 ) {
13.192 + sector_mode = GDROM_MODE1;
13.193 + } else {
13.194 + sector_mode = ((secthead.subhead[2] & 0x20) == 0 ) ? GDROM_MODE2_FORM1 : GDROM_MODE2_FORM2;
13.195 }
13.196 break;
13.197 + case GDROM_SEMIRAW_MODE2:
13.198 + gdrom_read_block( secthead.subhead, file_offset, 8, f );
13.199 + sector_mode = ((secthead.subhead[2] & 0x20) == 0 ) ? GDROM_MODE2_FORM1 : GDROM_MODE2_FORM2;
13.200 + break;
13.201 default:
13.202 + /* In the other cases, the track mode completely defines the sector mode */
13.203 + sector_mode = track->mode;
13.204 + break;
13.205 + }
13.206 +
13.207 + int mode_restrict = READ_CD_MODE(mode);
13.208 + if( !gdrom_is_compatible_read_mode(sector_mode, READ_CD_MODE(mode)) ) {
13.209 return PKT_ERR_BADREADMODE;
13.210 }
13.211 -
13.212 +
13.213 + /* Ok, we've got a valid sector, check what parts of the sector we need to
13.214 + * return - header | subhead | data | everything
13.215 + */
13.216 + int channels = READ_CD_CHANNELS(mode);
13.217 +
13.218 + if( channels == 0 ) {
13.219 + // legal, if weird
13.220 + *length = 0;
13.221 + return PKT_ERR_OK;
13.222 + } else if( channels == 0xA0 &&
13.223 + (sector_mode == GDROM_MODE2_FORM1 || sector_mode == GDROM_MODE2_FORM2 )) {
13.224 + // caller requested a non-contiguous region
13.225 + return PKT_ERR_BADFIELD;
13.226 + } else if( READ_CD_RAW(channels) ) {
13.227 + channels = 0xF0; // implies everything
13.228 + }
13.229 +
13.230 + read_len = 0;
13.231 + int start, size;
13.232 + switch( track->mode ) {
13.233 + case GDROM_CDDA:
13.234 + // audio is nice and simple (assume perfect reads for now)
13.235 + *length = 2352;
13.236 + gdrom_read_block( buf, file_offset, track->sector_size, f );
13.237 + return PKT_ERR_OK;
13.238 + case GDROM_RAW_XA:
13.239 + case GDROM_RAW_NONXA:
13.240 + gdrom_get_read_bounds( sector_mode, channels, &start, &size );
13.241 + gdrom_read_block( buf, file_offset+start, size, f );
13.242 + read_len = size;
13.243 + break;
13.244 + case GDROM_SEMIRAW_MODE2:
13.245 + gdrom_get_read_bounds( sector_mode, channels, &start, &size );
13.246 + if( READ_CD_HEADER(channels) ) {
13.247 + gdrom_build_sector_header( buf, lba, sector_mode );
13.248 + read_len += SECTOR_HEADER_SIZE;
13.249 + size -= SECTOR_HEADER_SIZE;
13.250 + } else {
13.251 + start -= SECTOR_HEADER_SIZE;
13.252 + }
13.253 + gdrom_read_block( buf + read_len, file_offset+start, size, f );
13.254 + read_len += size;
13.255 + break;
13.256 + default: // Data track w/ data only in file
13.257 + if( READ_CD_RAW(channels) ) {
13.258 + gdrom_read_block( buf + gdrom_data_offset[track->mode], file_offset,
13.259 + track->sector_size, f );
13.260 + do_encode_L2( buf, sector_mode, lba );
13.261 + read_len = 2352;
13.262 + } else {
13.263 + if( READ_CD_HEADER(channels) ) {
13.264 + gdrom_build_sector_header( buf, lba, sector_mode );
13.265 + read_len += SECTOR_HEADER_SIZE;
13.266 + }
13.267 + if( READ_CD_SUBHEAD(channels) &&
13.268 + (sector_mode == GDROM_MODE2_FORM1 || sector_mode == GDROM_MODE2_FORM2) ) {
13.269 + if( sector_mode == GDROM_MODE2_FORM1 ) {
13.270 + *((uint32_t *)(buf+read_len)) = 0;
13.271 + *((uint32_t *)(buf+read_len+4)) = 0;
13.272 + } else {
13.273 + *((uint32_t *)(buf+read_len)) = 0x00200000;
13.274 + *((uint32_t *)(buf+read_len+4)) = 0x00200000;
13.275 + }
13.276 + read_len += 8;
13.277 + }
13.278 + if( READ_CD_DATA(channels) ) {
13.279 + gdrom_read_block( buf+read_len, file_offset, track->sector_size, f );
13.280 + read_len += track->sector_size;
13.281 + }
13.282 + }
13.283 + }
13.284 *length = read_len;
13.285 return PKT_ERR_OK;
13.286 -
13.287 }
13.288
13.289 static gdrom_error_t gdrom_image_read_toc( gdrom_disc_t disc, unsigned char *buf )
14.1 --- a/src/gdrom/gdrom.c Tue Feb 26 01:10:48 2008 +0000
14.2 +++ b/src/gdrom/gdrom.c Sun Mar 02 11:38:08 2008 +0000
14.3 @@ -33,8 +33,9 @@
14.4 &gdi_image_class,
14.5 NULL };
14.6
14.7 -char *gdrom_mode_names[] = { "Mode1", "Mode2", "XA 1", "XA2", "Audio", "GD-Rom" };
14.8 -uint32_t gdrom_sector_size[] = { 2048, 2336, 2048, 2324, 2352, 2336 };
14.9 +char *gdrom_mode_names[] = { "Mode 0", "Mode 1", "Mode 2", "Mode 2 Form 1", "Mode 2 Form 2", "Audio",
14.10 + "Mode 2 semiraw", "XA Raw", "Non-XA Raw" };
14.11 +uint32_t gdrom_sector_size[] = { 0, 2048, 2336, 2048, 2324, 2352, 2336, 2352, 2352 };
14.12
14.13 gdrom_disc_t gdrom_image_open( const gchar *filename )
14.14 {
15.1 --- a/src/gdrom/gdrom.h Tue Feb 26 01:10:48 2008 +0000
15.2 +++ b/src/gdrom/gdrom.h Sun Mar 02 11:38:08 2008 +0000
15.3 @@ -37,25 +37,42 @@
15.4
15.5 extern uint32_t gdrom_sector_size[];
15.6 #define GDROM_SECTOR_SIZE(x) gdrom_sector_size[x]
15.7 +/**
15.8 + * Track data type enumeration for cd images and devices. This somewhat
15.9 + * conflates the real track mode with the format of the image file, but
15.10 + * it manages to make sense so far.
15.11 + */
15.12 typedef enum {
15.13 - GDROM_MODE1,
15.14 - GDROM_MODE2,
15.15 - GDROM_MODE2_XA1,
15.16 - GDROM_MODE2_XA2,
15.17 - GDROM_CDDA,
15.18 - GDROM_GD,
15.19 - GDROM_RAW
15.20 + GDROM_MODE0, // Mode 0 - should never actually see this
15.21 +/* Data-only modes (image file contains only the user data) */
15.22 + GDROM_MODE1, // Standard CD-Rom Mode 1 data track
15.23 + GDROM_MODE2_FORMLESS, // Mode 2 data track with no sub-structure (rare)
15.24 + GDROM_MODE2_FORM1, // Mode 2/Form 1 data track (standard for multisession)
15.25 + GDROM_MODE2_FORM2, // Mode 2/Form 2 data track (also fairly uncommon).
15.26 + GDROM_CDDA, // Standard audio track
15.27 +
15.28 +/* This one is somewhat special - the image file contains the 2336 bytes of
15.29 + * "extended user data", which in turn contains either a form 1 or form 2
15.30 + * sector. In other words it's a raw mode2 XA sector without the 16-byte header.
15.31 + */
15.32 + GDROM_SEMIRAW_MODE2,
15.33 +/* Raw modes (image contains the full 2352-byte sector). Split into XA/Non-XA
15.34 + * here for convenience, although it's really a session level flag. */
15.35 + GDROM_RAW_XA,
15.36 + GDROM_RAW_NONXA,
15.37 } gdrom_track_mode_t;
15.38
15.39 /* The disc register indicates the current contents of the drive. When open
15.40 * contains 0x06.
15.41 */
15.42 -#define IDE_DISC_AUDIO 0x00
15.43 -#define IDE_DISC_NONE 0x06
15.44 -#define IDE_DISC_CDROM 0x20
15.45 -#define IDE_DISC_GDROM 0x80
15.46 #define IDE_DISC_READY 0x01 /* ored with above */
15.47 #define IDE_DISC_IDLE 0x02 /* ie spun-down */
15.48 +#define IDE_DISC_NONE 0x06
15.49 +
15.50 +#define IDE_DISC_AUDIO 0x00
15.51 +#define IDE_DISC_CDROM 0x10
15.52 +#define IDE_DISC_CDROMXA 0x20
15.53 +#define IDE_DISC_GDROM 0x80
15.54
15.55 #define TRACK_PRE_EMPHASIS 0x10
15.56 #define TRACK_COPY_PERMITTED 0x20
16.1 --- a/src/gdrom/nrg.c Tue Feb 26 01:10:48 2008 +0000
16.2 +++ b/src/gdrom/nrg.c Sun Mar 02 11:38:08 2008 +0000
16.3 @@ -154,8 +154,8 @@
16.4 {
16.5 switch( mode ) {
16.6 case 0: return GDROM_MODE1;
16.7 - case 2: return GDROM_MODE2_XA1;
16.8 - case 3: return GDROM_MODE2;
16.9 + case 2: return GDROM_MODE2_FORM1;
16.10 + case 3: return GDROM_SEMIRAW_MODE2;
16.11 case 7: return GDROM_CDDA;
16.12 default:
16.13 ERROR( "Unrecognized track mode %d in Nero image", mode );
17.1 --- a/src/gdrom/packet.h Tue Feb 26 01:10:48 2008 +0000
17.2 +++ b/src/gdrom/packet.h Sun Mar 02 11:38:08 2008 +0000
17.3 @@ -66,5 +66,17 @@
17.4 #define PKT_ERR_BADREADMODE 0x6405 /* Illegal mode for this track */
17.5 #define PKT_ERR_RESET 0x2906
17.6
17.7 -#define IDE_READ_MODE1 0x20
17.8 -#define IDE_READ_RAW 0x30
17.9 +/* Parse CD read */
17.10 +#define READ_CD_MODE(x) ((x)&0x0E)
17.11 +#define READ_CD_MODE_ANY 0x00
17.12 +#define READ_CD_MODE_CDDA 0x02
17.13 +#define READ_CD_MODE_1 0x04
17.14 +#define READ_CD_MODE_2 0x06
17.15 +#define READ_CD_MODE_2_FORM_1 0x08
17.16 +#define READ_CD_MODE_2_FORM_2 0x0A
17.17 +
17.18 +#define READ_CD_CHANNELS(x) ((x)&0xF0)
17.19 +#define READ_CD_HEADER(x) ((x)&0x80)
17.20 +#define READ_CD_SUBHEAD(x) ((x)&0x40)
17.21 +#define READ_CD_DATA(x) ((x)&0x20)
17.22 +#define READ_CD_RAW(x) ((x)&0x10)
.