annotate spudec.c @ 560:28ae99036574

Separated dvdsub code to be able to work with it easier
author lgb
date Sat, 21 Apr 2001 15:38:01 +0000
parents
children 36fd71db0d33
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
560
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
1 /* SPUdec.c
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
2 Skeleton of function spudec_process_controll() was written by Apri.
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
3 Further works:
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
4 LGB,... (yeah, try to improve it and insert your name here! ;-) */
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
5
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
6
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
7 #include <stdio.h>
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
8 #include "spudec.h"
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
9
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
10
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
11
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
12
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
13 void spudec_process_control(unsigned char *control, int size, int* d1, int* d2)
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
14 {
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
15 int off = 2;
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
16 int a,b; /* Temporary vars */
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
17
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
18 do {
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
19 int type = control[off];
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
20 off++;
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
21 printf("cmd=%d ",type);
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
22
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
23 switch(type) {
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
24 case 0x00:
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
25 /* Menu ID, 1 byte */
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
26 printf("Menu ID\n");
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
27 break;
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
28 case 0x01:
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
29 /* Start display */
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
30 printf("Start display!\n");
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
31 // gSpudec.geom.bIsVisible = 1;
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
32 break;
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
33 case 0x03:
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
34 /* Palette */
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
35 printf("Palette\n");
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
36 // palette[3] = &(gSpudec.clut[(control[off] >> 4)]);
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
37 // palette[2] = &(gSpudec.clut[control[off] & 0xf]);
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
38 // palette[1] = &(gSpudec.clut[(control[off+1] >> 4)]);
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
39 // palette[0] = &(gSpudec.clut[control[off+1] & 0xf]);
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
40 off+=2;
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
41 break;
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
42 case 0x04:
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
43 /* Alpha */
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
44 printf("Alpha\n");
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
45 // alpha[3] = control[off] & 0xf0;
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
46 // alpha[2] = (control[off] & 0xf) << 4;
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
47 // alpha[1] = control[off+1] & 0xf0;
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
48 // alpha[0] = (control[off+1] & 0xf) << 4;
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
49 off+=2;
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
50 break;
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
51 case 0x05:
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
52 /* Co-ords */
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
53 a = (control[off] << 16) + (control[off+1] << 8) + control[off+2];
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
54 b = (control[off+3] << 16) + (control[off+4] << 8) + control[off+5];
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
55
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
56 printf("Coords col: %d - %d row: %d - %d\n",a >> 12,a & 0xfff,b >> 12,b & 0xfff);
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
57
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
58 // gSpudec.geom.start_col = a >> 12;
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
59 // gSpudec.geom.end_col = a & 0xfff;
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
60 // gSpudec.geom.start_row = b >> 12;
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
61 // gSpudec.geom.end_row = b & 0xfff;
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
62
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
63 off+=6;
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
64 break;
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
65 case 0x06:
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
66 /* Graphic lines */
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
67 *(d1) = (control[off] << 8) + control[off+1];
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
68 *(d2) = (control[off+2] << 8) + control[off+3];
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
69 printf("Graphic pos color: %d b/w: %d\n",*d1,*d2);
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
70 off+=4;
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
71 break;
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
72 case 0xff:
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
73 /* All done, bye-bye */
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
74 printf("Done!\n");
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
75 return;
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
76 break;
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
77 default:
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
78 printf("spudec: Error determining control type 0x%02x.\n",type);
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
79 return;
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
80 break;
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
81 }
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
82
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
83 /* printf("spudec: Processsed control type 0x%02x.\n",type); */
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
84 } while(off < size);
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
85 }
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
86
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
87
28ae99036574 Separated dvdsub code to be able to work with it easier
lgb
parents:
diff changeset
88