Exemple #1
0
void Copy_Chunk( FILE *fp )  
    {
     uint32_t x, y;
     unsigned char pixel_data;

     /* A copy chunk just has 64000 bytes of data to pop
        straight to video memory */

     for( y = 0; y < 200; y++ )
         {
          for( x = 0; x < 320; x++ )
              {
               fread( &pixel_data, sizeof( unsigned char ), 1, fp );
               DB_Fast_Pixel( x, y, pixel_data );
              }
         }
    }
Exemple #2
0
void Copy_Chunk_Ram( uint8_t *file_buffer, uint32_t *file_pos  )  
    {
     long x, y;
     unsigned char pixel_data;

     /* A copy chunk just has 64000 bytes of data to pop
        straight to video memory */

     for( y = 0; y < 200; y++ )
         {
          for( x = 0; x < 320; x++ )
              {
               pixel_data = file_buffer[ (*file_pos)++ ];
               DB_Fast_Pixel( x, y, pixel_data );
              }
         }
    } /* End of Copy_Chunk_Ram() */
Exemple #3
0
void Delta_Chunk_Ram( uint8_t *file_buffer, uint32_t *file_pos )
    {
     unsigned long line_index;       /* Number of lines processed  */
     unsigned long pixel_index = 0;  /* Number of pixels processed */
     
     short lines_to_skip;           /* Number of lines to skip    */
     unsigned short number_lines;   /* Number of lines encoded for frame */
     
     unsigned char num_packets;     /* Number of packets in line  */
     
     unsigned long packet_index;     /* Index for loop             */
     unsigned char skip_count;      /* Number of xpixels to skip  */
     char packet_type;              /* Type of delta encoding     */
     
     unsigned char pixel_data;      /* One pixel to put on screen */
     unsigned long byte_count;       /* Index for loop             */
     long x, y;
     unsigned long i;
     unsigned char *temp_buffer;


     /* Get the y position we start on */ 
     temp_buffer = (unsigned char *)&lines_to_skip;
     for( i = 0; i < sizeof( short ); i++ )
         temp_buffer[i] = file_buffer[ (*file_pos)++ ];
     /* Get the number of lines encoded */
     temp_buffer = (unsigned char *)&number_lines;
     for( i = 0; i < sizeof( short ); i++ )
         temp_buffer[i] = file_buffer[ (*file_pos)++ ];
     

     x = y = 0;

     y += lines_to_skip; /* Move to line lines_to_skip */
     

     for( line_index = 0; line_index < number_lines; line_index++ )
         {
          num_packets = file_buffer[ (*file_pos)++ ];

          for( packet_index = 0; packet_index < num_packets; packet_index++ )
              {
               /* Get number of x pixels to skip on this packet */
               skip_count  = file_buffer[ (*file_pos)++ ];   

               /* Get type of packet encoding */
               packet_type = file_buffer[ (*file_pos)++ ];   

               x += skip_count; /* Add the skip count to our x value */


               /* If packet type is positive, copy packet_type
                  number of pixels from the file to the screen... */
               if( packet_type > 0 )
                   {
                    for( byte_count = 0; byte_count < (unsigned long)packet_type; byte_count++ ) 
                        {
                         pixel_data = file_buffer[ (*file_pos)++ ];   
                         pixel_index++;
                         DB_Fast_Pixel( x, y, pixel_data );
                         x++;
                        }
                   }
               /* If packet type is negative, take its absolute value,
                  and replicate one byte from the file packet_type 
                  times */
               else
                   {
                    packet_type = -packet_type;
                    pixel_data = file_buffer[ (*file_pos)++ ];   
                    for( byte_count = 0; byte_count < (unsigned long)packet_type; byte_count++ )
                        {
                         pixel_index++;
                         DB_Fast_Pixel( x, y, pixel_data ); 
                         x++;
                        }

                   } /* End if else */
    
              } /* End for packet index */

         y++;   /* Move to next line */
         x = 0; /* Move to beginning of line */ 
         
         } /* End for line index */    
    
    } /* End of Delta_Chunk_Ram() */
Exemple #4
0
/* Delta chunk is the most common type of chunk...
   it contains the changes in the image from the last
   frame */
void Delta_Chunk( FILE *fp )
    {
     uint32_t line_index;       /* Number of lines processed  */
     uint32_t pixel_index = 0;  /* Number of pixels processed */
     uint32_t pos;              /* Position in file           */
     
     int16_t lines_to_skip;           /* Number of lines to skip    */
     uint16_t number_lines;   /* Number of lines encoded for frame */
     
     uint8_t num_packets;     /* Number of packets in line  */
     
     uint32_t packet_index;     /* Index for loop             */
     uint8_t skip_count;      /* Number of xpixels to skip  */
     int8_t packet_type;              /* Type of delta encoding     */
     
     uint8_t pixel_data;      /* One pixel to put on screen */
     uint32_t byte_count;       /* Index for loop             */
     int32_t x, y;


     pos = ftell( fp ); /* Record our position in the file */

     /* Get the y position we start on */ 
     fread( &lines_to_skip, sizeof(int16_t), 1, fp );  
     /* Get the number of lines encoded */
     fread( &number_lines,  sizeof(int16_t), 1, fp );
     
     x = y = 0;

     y += lines_to_skip; /* Move to line lines_to_skip */
     

     for( line_index = 0; line_index < number_lines; line_index++ )
         {
          fread( &num_packets, sizeof( unsigned char ), 1, fp );

          for( packet_index = 0; packet_index < num_packets; packet_index++ )
              {
               /* Get number of x pixels to skip on this packet */
               fread( &skip_count, sizeof( unsigned char ), 1, fp );           
               /* Get type of packet encoding */
               fread( &packet_type, sizeof( char ), 1, fp );
               
               x += skip_count; /* Add the skip count to our x value */
               
               /* If packet type is positive, copy packet_type
                  number of pixels from the file to the screen... */
               if( packet_type > 0 )
                   {
                    for( byte_count = 0; byte_count < (uint32_t)packet_type; byte_count++ ) 
                        {
                         fread( &pixel_data, sizeof( char ), 1, fp );
                         pixel_index++;
                         DB_Fast_Pixel( x, y, pixel_data ); 
                         x++;
                        }
                   }
               /* If packet type is negative, take its absolute value,
                  and replicate one byte from the file packet_type 
                  times */
               else
                   {
                    packet_type = -packet_type;
                    fread( &pixel_data, sizeof(char), 1, fp );

                    for( byte_count = 0; byte_count < (uint32_t)packet_type; byte_count++ )
                        {
                         pixel_index++;
                         DB_Fast_Pixel( x, y, pixel_data ); 
                         x++;
                        }

                   } /* End if else */
    
              } /* End for packet index */

         y++;   /* Move to next line */
         x = 0; /* Move to beginning of line */ 
         
         } /* End for line index */    
    
    } /* End of delta_chunk */