void bunzip(struct bitstream_st *ibs, struct bitstream_st *obs) { #ifdef CONFIG_DECOMPRESS # ifdef CONFIG_FANCY_UI if (main_runtime.decompress_frag) { unsigned i; int blocked; blocked = output_bs.blocked; output_bs.blocked = 1; for (i = main_runtime.decompress_frag; i > 1; i--) { bs_crc_init(obs); decompress(); bs_align(ibs); } output_bs.blocked = blocked; bs_rewind(obs); } # endif /* CONFIG_FANCY_UI */ do { bs_crc_init(obs); decompress(); bs_align(ibs); if (main_runtime.decompress_frag) break; } while (!bs_eof(ibs)); #endif /* CONFIG_DECOMPRESS */ } /* bunzip */
void bzip(struct bitstream_st *ibs, struct bitstream_st *obs) { #ifdef CONFIG_COMPRESS bs_crc_init(ibs); compress(); bs_align(obs); #endif } /* bzip */
/***************************************************************************** * SVCDSubRenderImage: reorders bytes of image data in subpicture region. ***************************************************************************** The image is encoded using two bits per pixel that select a palette entry except that value 0 starts a limited run-length encoding for color 0. When 0 is seen, the next two bits encode one less than the number of pixels, so we can encode run lengths from 1 to 4. These get filled with the color in palette entry 0. The encoding of each line is padded to a whole number of bytes. The first field is padded to an even byte length and the complete subtitle is padded to a 4-byte multiple that always include one zero byte at the end. However we'll transform this so that that the RLE is expanded and interlacing will also be removed. *****************************************************************************/ static void SVCDSubRenderImage( decoder_t *p_dec, block_t *p_data, subpicture_region_t *p_region ) { decoder_sys_t *p_sys = p_dec->p_sys; uint8_t *p_dest = p_region->p_picture->Y_PIXELS; int i_field; /* The subtitles are interlaced */ int i_row, i_column; /* scanline row/column number */ uint8_t i_color, i_count; bs_t bs; bs_init( &bs, p_data->p_buffer + p_sys->i_image_offset, p_data->i_buffer - p_sys->i_image_offset ); for( i_field = 0; i_field < 2; i_field++ ) { for( i_row = i_field; i_row < p_sys->i_height; i_row += 2 ) { for( i_column = 0; i_column < p_sys->i_width; i_column++ ) { i_color = bs_read( &bs, 2 ); if( i_color == 0 && (i_count = bs_read( &bs, 2 )) ) { i_count = __MIN( i_count, p_sys->i_width - i_column ); memset( &p_dest[i_row * p_region->p_picture->Y_PITCH + i_column], 0, i_count + 1 ); i_column += i_count; continue; } p_dest[i_row * p_region->p_picture->Y_PITCH + i_column] = i_color; } bs_align( &bs ); } /* odd field */ bs_init( &bs, p_data->p_buffer + p_sys->i_image_offset + p_sys->second_field_offset, p_data->i_buffer - p_sys->i_image_offset - p_sys->second_field_offset ); } }