compress_flc(char *name) { int x; Open_FLC (name); charcolors[0]=0; charcolors[1]=0x7fff; Get_first_frame (); Decompress_frame (); curcolor=0;bar(0,0,639,479); open_frame(); create_mgif_lzw(); reserve_track(); close_frame();write_frame_size(last_frame_size,max_colors); show_screen(); for (x=2; x<=h_flc.frames; x++) { Get_next_frame (); Decompress_frame (); open_frame(); create_mgif_delta(); reserve_track(); close_frame(); write_frame_size(last_frame_size,max_colors); if (last_frame_size>MAX_FRAME) hdiff++; else if (last_frame_size<MIN_FRAME && hranice>0) hdiff--; else if (hdiff>0) hdiff--;else if(hdiff<0) hdiff++; show_screen (); } Close_FLC(); }
compress_pcx(char *name) { int x=0; get_palette_ptr=flc_paleta; curcolor=0;bar(0,0,639,479); //prepare_for_mjpg(); while (get_pcx_frame(name,x)) { open_frame(); if (x) create_mgif_delta();else create_mgif_lzw(); reserve_track(); //create_jpg_frame(); close_frame(); curcolor=0;bar(0,400,639,430); write_frame_name(name,x); write_frame_size(last_frame_size,max_colors); if (last_frame_size>MAX_FRAME) {difdif=difdif<=0?1:difdif+1;hdiff+=difdif;} else if (last_frame_size<MIN_FRAME && hranice>0) {difdif=difdif>=0?-1:difdif-1;hdiff+=difdif;} else if (hdiff>0) {difdif=difdif>=0?-1:difdif-1;hdiff+=difdif;}else if(hdiff<0) hdiff=0; show_screen (); if (statpic) statpic--;else x+=frame_step; global_frame_counter++; } }
static void write_uncompressed_header(VP9_COMP *cpi, struct vpx_write_bit_buffer *wb) { VP9_COMMON *const cm = &cpi->common; MACROBLOCKD *const xd = &cpi->td.mb.e_mbd; vpx_wb_write_literal(wb, VP9_FRAME_MARKER, 2); write_profile(cm->profile, wb); vpx_wb_write_bit(wb, 0); // show_existing_frame vpx_wb_write_bit(wb, cm->frame_type); vpx_wb_write_bit(wb, cm->show_frame); vpx_wb_write_bit(wb, cm->error_resilient_mode); if (cm->frame_type == KEY_FRAME) { write_sync_code(wb); write_bitdepth_colorspace_sampling(cm, wb); write_frame_size(cm, wb); } else { // In spatial svc if it's not error_resilient_mode then we need to code all // visible frames as invisible. But we need to keep the show_frame flag so // that the publisher could know whether it is supposed to be visible. // So we will code the show_frame flag as it is. Then code the intra_only // bit here. This will make the bitstream incompatible. In the player we // will change to show_frame flag to 0, then add an one byte frame with // show_existing_frame flag which tells the decoder which frame we want to // show. if (!cm->show_frame) vpx_wb_write_bit(wb, cm->intra_only); if (!cm->error_resilient_mode) vpx_wb_write_literal(wb, cm->reset_frame_context, 2); if (cm->intra_only) { write_sync_code(wb); // Note for profile 0, 420 8bpp is assumed. if (cm->profile > PROFILE_0) { write_bitdepth_colorspace_sampling(cm, wb); } vpx_wb_write_literal(wb, get_refresh_mask(cpi), REF_FRAMES); write_frame_size(cm, wb); } else { MV_REFERENCE_FRAME ref_frame; vpx_wb_write_literal(wb, get_refresh_mask(cpi), REF_FRAMES); for (ref_frame = LAST_FRAME; ref_frame <= ALTREF_FRAME; ++ref_frame) { assert(get_ref_frame_map_idx(cpi, ref_frame) != INVALID_IDX); vpx_wb_write_literal(wb, get_ref_frame_map_idx(cpi, ref_frame), REF_FRAMES_LOG2); vpx_wb_write_bit(wb, cm->ref_frame_sign_bias[ref_frame]); } write_frame_size_with_refs(cpi, wb); vpx_wb_write_bit(wb, cm->allow_high_precision_mv); fix_interp_filter(cm, cpi->td.counts); write_interp_filter(cm->interp_filter, wb); } } if (!cm->error_resilient_mode) { vpx_wb_write_bit(wb, cm->refresh_frame_context); vpx_wb_write_bit(wb, cm->frame_parallel_decoding_mode); } vpx_wb_write_literal(wb, cm->frame_context_idx, FRAME_CONTEXTS_LOG2); encode_loopfilter(&cm->lf, wb); encode_quantization(cm, wb); encode_segmentation(cm, xd, wb); write_tile_info(cm, wb); }