comparison decoder.c @ 114:b6834e6359cf src

big libdvdnav cleanup, quoting the ChangeLog: * some bugfixes * code cleanup * build process polishing * more sensible event order in get_next_block to ensure useful event delivery * VOBU level resume * fixed: seeking in a multiangle feature briefly showed the wrong angle
author mroi
date Thu, 20 Feb 2003 15:32:21 +0000
parents 96707bfb63d7
children 5897ff629f7c
comparison
equal deleted inserted replaced
113:ec2df154be56 114:b6834e6359cf
39 uint32_t vm_getbits(command_t *command, int start, int count) { 39 uint32_t vm_getbits(command_t *command, int start, int count) {
40 uint64_t result = 0; 40 uint64_t result = 0;
41 uint64_t bit_mask=0xffffffffffffffff; /* I could put -1 instead */ 41 uint64_t bit_mask=0xffffffffffffffff; /* I could put -1 instead */
42 uint64_t examining = 0; 42 uint64_t examining = 0;
43 int32_t bits; 43 int32_t bits;
44
44 if (count == 0) return 0; 45 if (count == 0) return 0;
45 46
46 if ( ((count+start) > 64) || 47 if ( ((count+start) > 64) ||
47 (count > 32) || 48 (count > 32) ||
48 (start > 63) || 49 (start > 63) ||
49 (count < 0) || 50 (count < 0) ||
50 (start < 0) ){ 51 (start < 0) ) {
51 fprintf(MSG_OUT, "libdvdnav: Bad call to vm_getbits. Parameter out of range\n"); 52 fprintf(MSG_OUT, "libdvdnav: Bad call to vm_getbits. Parameter out of range\n");
52 assert(0); 53 assert(0);
53 } 54 }
54 bit_mask >>= start; 55 bit_mask >>= start;
55 bits = 64-count-start; 56 bits = 64-count-start;
99 SXXX_XXXX, where S is 1 if it is system register. */ 100 SXXX_XXXX, where S is 1 if it is system register. */
100 static uint16_t eval_reg(command_t* command, uint8_t reg) { 101 static uint16_t eval_reg(command_t* command, uint8_t reg) {
101 if(reg & 0x80) { 102 if(reg & 0x80) {
102 if ((reg & 0x1f) == 20) { 103 if ((reg & 0x1f) == 20) {
103 fprintf(MSG_OUT, "libdvdnav: Suspected RCE Region Protection!!!"); 104 fprintf(MSG_OUT, "libdvdnav: Suspected RCE Region Protection!!!");
104 } 105 }
105 return command->registers->SPRM[reg & 0x1f]; /* FIXME max 24 not 32 */ 106 return command->registers->SPRM[reg & 0x1f]; /* FIXME max 24 not 32 */
106 } else { 107 } else {
107 return get_GPRM(command->registers, reg & 0x0f) ; 108 return get_GPRM(command->registers, reg & 0x0f) ;
108 } 109 }
109 } 110 }
568 } 569 }
569 570
570 return res; 571 return res;
571 } 572 }
572 573
573 /* Evaluate a set of commands in the given register set (which is 574 /* Evaluate a set of commands in the given register set (which is modified) */
574 * modified */
575 int32_t vmEval_CMD(vm_cmd_t commands[], int32_t num_commands, 575 int32_t vmEval_CMD(vm_cmd_t commands[], int32_t num_commands,
576 registers_t *registers, link_t *return_values) { 576 registers_t *registers, link_t *return_values) {
577 int32_t i = 0; 577 int32_t i = 0;
578 int32_t total = 0; 578 int32_t total = 0;
579 579
585 for(i = 0; i < num_commands; i++) 585 for(i = 0; i < num_commands; i++)
586 vmPrint_CMD(i, &commands[i]); 586 vmPrint_CMD(i, &commands[i]);
587 fprintf(MSG_OUT, "libdvdnav: --------------------------------------------\n"); 587 fprintf(MSG_OUT, "libdvdnav: --------------------------------------------\n");
588 fprintf(MSG_OUT, "libdvdnav: Single stepping commands\n"); 588 fprintf(MSG_OUT, "libdvdnav: Single stepping commands\n");
589 #endif 589 #endif
590
590 i = 0; 591 i = 0;
591 while(i < num_commands && total < 100000) { 592 while(i < num_commands && total < 100000) {
592 int32_t line; 593 int32_t line;
593 594
594 #ifdef TRACE 595 #ifdef TRACE
595 vmPrint_CMD(i, &commands[i]); 596 vmPrint_CMD(i, &commands[i]);
596 #endif 597 #endif
598
597 line = eval_command(&commands[i].bytes[0], registers, return_values); 599 line = eval_command(&commands[i].bytes[0], registers, return_values);
598 600
599 if (line < 0) { /* Link command */ 601 if (line < 0) { /* Link command */
600 #ifdef TRACE 602 #ifdef TRACE
601 fprintf(MSG_OUT, "libdvdnav: Registers after transaction\n"); 603 fprintf(MSG_OUT, "libdvdnav: Registers after transaction\n");
618 fprintf(MSG_OUT, "libdvdnav: Registers after transaction\n"); 620 fprintf(MSG_OUT, "libdvdnav: Registers after transaction\n");
619 vmPrint_registers( registers ); 621 vmPrint_registers( registers );
620 #endif 622 #endif
621 return 0; 623 return 0;
622 } 624 }
625
626 #ifdef TRACE
623 627
624 static char *linkcmd2str(link_cmd_t cmd) { 628 static char *linkcmd2str(link_cmd_t cmd) {
625 switch(cmd) { 629 switch(cmd) {
626 case LinkNoLink: 630 case LinkNoLink:
627 return "LinkNoLink"; 631 return "LinkNoLink";
760 fprintf(MSG_OUT, "\nlibdvdnav: Gtime: "); 764 fprintf(MSG_OUT, "\nlibdvdnav: Gtime: ");
761 for(i = 0; i < 16; i++) 765 for(i = 0; i < 16; i++)
762 fprintf(MSG_OUT, "%04lx|", registers->GPRM_time[i].tv_sec & 0xffff); 766 fprintf(MSG_OUT, "%04lx|", registers->GPRM_time[i].tv_sec & 0xffff);
763 fprintf(MSG_OUT, "\n"); 767 fprintf(MSG_OUT, "\n");
764 } 768 }
769
770 #endif
771