summaryrefslogtreecommitdiff
path: root/yazedc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'yazedc.cpp')
-rw-r--r--yazedc.cpp159
1 files changed, 0 insertions, 159 deletions
diff --git a/yazedc.cpp b/yazedc.cpp
index 9d5b838..f4bced0 100644
--- a/yazedc.cpp
+++ b/yazedc.cpp
@@ -856,162 +856,3 @@ int set_sector_type(int st)
}
/* ------------- --------------*/
-#ifdef MAIN
-
-#define DO_L1 1
-#define DO_L2 2
-#define DO_SUB 4
-
-static const unsigned sect_size[8][2] = {
-/* nothing */
-{0,0},
-/* Layer 1 decode/encode */
-{ (L1_RAW+L1_Q+L1_P)*FRAMES_PER_SECTOR, L1_RAW*FRAMES_PER_SECTOR},
-/* Layer 2 decode/encode */
-{ 16+L2_RAW+12+L2_Q+L2_P, L2_RAW},
-/* Layer 1 and 2 decode/encode */
-{ (L1_RAW+L1_Q+L1_P)*FRAMES_PER_SECTOR, L1_RAW*FRAMES_PER_SECTOR},
-/* Subchannel decode/encode */
-{ (LSUB_RAW+LSUB_Q+LSUB_P)*PACKETS_PER_SUBCHANNELFRAME,
- LSUB_RAW*PACKETS_PER_SUBCHANNELFRAME},
-/* Layer 1 and subchannel decode/encode */
-{ (L1_RAW+L1_Q+L1_P)*FRAMES_PER_SECTOR +
- (LSUB_RAW+LSUB_Q+LSUB_P)*PACKETS_PER_SUBCHANNELFRAME,
- LSUB_RAW*PACKETS_PER_SUBCHANNELFRAME +
- L1_RAW*FRAMES_PER_SECTOR},
-/* Layer 2 and subchannel decode/encode */
-{ L2_RAW+L2_Q+L2_P+
- (LSUB_RAW+LSUB_Q+LSUB_P)*PACKETS_PER_SUBCHANNELFRAME,
- LSUB_RAW*PACKETS_PER_SUBCHANNELFRAME +
- L2_RAW},
-/* Layer 1, 2 and subchannel decode/encode */
-{ (L1_RAW+L1_Q+L1_P)*FRAMES_PER_SECTOR +
- (LSUB_RAW+LSUB_Q+LSUB_P)*PACKETS_PER_SUBCHANNELFRAME,
- LSUB_RAW*PACKETS_PER_SUBCHANNELFRAME +
- L1_RAW*FRAMES_PER_SECTOR},
-};
-
-int main(int argc, char **argv)
-{
- int encode = 1;
- int mask = DO_L2;
- FILE * infp;
- FILE * outfp;
- unsigned address = 0;
- unsigned char *l1_inbuf;
- unsigned char *l1_outbuf;
- unsigned char *l2_inbuf;
- unsigned char *l2_outbuf;
- unsigned char *sub_inbuf;
- unsigned char *sub_outbuf;
- unsigned char *last_outbuf;
- unsigned char inbuf[(LSUB_RAW+LSUB_Q+LSUB_P)*PACKETS_PER_SUBCHANNELFRAME +
- (L1_RAW+L1_Q+L1_P)*FRAMES_PER_SECTOR];
- unsigned char outbuf[(LSUB_RAW+LSUB_Q+LSUB_P)*PACKETS_PER_SUBCHANNELFRAME +
- (L1_RAW+L1_Q+L1_P)*FRAMES_PER_SECTOR];
- unsigned load_offset;
-
- l1_inbuf = l2_inbuf = sub_inbuf = inbuf;
- l1_outbuf = l2_outbuf = sub_outbuf = last_outbuf = outbuf;
-
- infp = fopen("sectors_in", "rb");
- outfp = fopen("sectors_out", "wb");
-
- sectortype= MODE_2_FORM_1;
- address = 0 + 75*2;
-
- switch (sectortype) {
- case MODE_1:
- case MODE_2:
- load_offset = 16;
- break;
- case MODE_2_FORM_1:
- case MODE_2_FORM_2:
- load_offset = 24;
- break;
- default:
- load_offset = 0;
- }
- while(1) {
-
- if (1 != fread(inbuf+load_offset,
- sect_size[mask][encode], 1, infp)) { perror(""); break; }
- if (encode == 1) {
- if (mask & DO_L2) {
- switch (sectortype) {
- case MODE_0:
- break;
- case MODE_1:
- break;
- case MODE_2:
- if (1 !=
- fread(inbuf+load_offset+
- sect_size[mask][encode],
- 2336 - sect_size[mask][encode],
- 1, infp)) { perror(""); break; }
- break;
- case MODE_2_FORM_1:
- break;
- case MODE_2_FORM_2:
- if (1 !=
- fread(inbuf+load_offset+
- sect_size[mask][encode],
- 2324 - sect_size[mask][encode],
- 1, infp)) { perror(""); break; }
- break;
- default:
- if (1 !=
- fread(inbuf+load_offset+
- sect_size[mask][encode],
- 2448 - sect_size[mask][encode],
- 1, infp)) { perror(""); break; }
- memset(inbuf,0,16);
- /*memset(inbuf+16+2048,0,12+272);*/
- break;
- }
- do_encode_L2(l2_inbuf, MODE_1, address);
- if (0) scramble_L2(l2_inbuf);
- last_outbuf = l1_inbuf = l2_inbuf;
- l1_outbuf = l2_inbuf;
- sub_inbuf = l2_inbuf + L2_RAW;
- sub_outbuf = l2_outbuf + 12 + 4+ L2_RAW+4+ 8+ L2_Q+L2_P;
- }
- if (mask & DO_L1) {
- do_encode_L1(l1_inbuf, l1_outbuf,1,1,1,1);
- last_outbuf = l1_outbuf;
- sub_inbuf = l1_inbuf + L1_RAW*FRAMES_PER_SECTOR;
- sub_outbuf = l1_outbuf + (L1_RAW+L1_Q+L1_P)*FRAMES_PER_SECTOR;
- }
- if (mask & DO_SUB) {
- do_encode_sub(sub_inbuf, sub_outbuf, 0, 0);
- }
- } else {
- if (mask & DO_L1) {
- do_decode_L1(l1_inbuf, l1_outbuf,1,1,1,1);
- last_outbuf = l2_inbuf = l1_outbuf;
- l2_outbuf = l1_inbuf;
- sub_inbuf = l1_inbuf + (L1_RAW+L1_Q+L1_P)*FRAMES_PER_SECTOR;
- sub_outbuf = l1_outbuf + L1_RAW*FRAMES_PER_SECTOR;
- }
- if (mask & DO_L2) {
- do_decode_L2(l2_inbuf, l2_outbuf);
- last_outbuf = l2_outbuf;
- sub_inbuf = l2_inbuf + L2_RAW+L2_Q+L2_P;
- sub_outbuf = l2_outbuf + L2_RAW;
- }
- if (mask & DO_SUB) {
- do_decode_sub(sub_inbuf, sub_outbuf, 1, 1);
- }
- }
- if (1 != fwrite(last_outbuf, sect_size[mask][1 - encode], 1, outfp)) {
- perror("");
- break;
- }
- address++;
- }
-#if 0
- /* flush the data from the delay lines with zeroed sectors, if necessary */
-#endif
- return 0;
-}
-#endif