void TimgFilterSharpen::done(void) { if (Ymin) { xvid_free(Ymin); Ymin=NULL; } if (Ymax) { xvid_free(Ymax); Ymax=NULL; } }
xint m4v_free_decoder(DEC_CTRL * xparam) { DECODER *dec = (DECODER *) xparam->handle; xvid_free(dec->mbs); xvid_free(dec->slice); image_destroy(&dec->refn, dec->edged_width, dec->edged_height); image_destroy(&dec->cur, dec->edged_width, dec->edged_height); xvid_free(dec); write_timer(); cleanup_timer(); return XVID_ERR_OK; }
void image_destroy(IMAGE * image, uint32_t edged_width, uint32_t edged_height) { const uint32_t edged_width2 = edged_width / 2; if (image->y) { xvid_free(image->y - (EDGE_SIZE * edged_width + EDGE_SIZE)); image->y = NULL; } if (image->u) { xvid_free(image->u - (EDGE_SIZE2 * edged_width2 + EDGE_SIZE2)); image->u = NULL; } if (image->v) { xvid_free(image->v - (EDGE_SIZE2 * edged_width2 + EDGE_SIZE2)); image->v = NULL; } }
int32_t image_create(IMAGE * image, uint32_t edged_width, uint32_t edged_height) { const uint32_t edged_width2 = edged_width / 2; const uint32_t edged_height2 = edged_height / 2; image->y = xvid_malloc(edged_width * (edged_height + 1) + SAFETY, CACHE_LINE); if (image->y == NULL) { return -1; } memset(image->y, 0, edged_width * (edged_height + 1) + SAFETY); image->u = xvid_malloc(edged_width2 * edged_height2 + SAFETY, CACHE_LINE); if (image->u == NULL) { xvid_free(image->y); image->y = NULL; return -1; } memset(image->u, 0, edged_width2 * edged_height2 + SAFETY); image->v = xvid_malloc(edged_width2 * edged_height2 + SAFETY, CACHE_LINE); if (image->v == NULL) { xvid_free(image->u); image->u = NULL; xvid_free(image->y); image->y = NULL; return -1; } memset(image->v, 0, edged_width2 * edged_height2 + SAFETY); image->y += EDGE_SIZE * edged_width + EDGE_SIZE; image->u += EDGE_SIZE2 * edged_width2 + EDGE_SIZE2; image->v += EDGE_SIZE2 * edged_width2 + EDGE_SIZE2; return 0; }
void av_free(void *p) { xvid_free(p); };
void TimgFilterTimesmooth::done(void) { if (accumY) xvid_free(accumY);accumY=NULL; if (accumU) xvid_free(accumU);accumU=NULL; if (accumV) xvid_free(accumV);accumV=NULL; }
xint m4v_init_decoder(DEC_CTRL * param, uint8 * video_header, xint header_size) { DECODER *dec; dec = xvid_malloc(sizeof(DECODER), CACHE_LINE); if (dec == NULL) { return XVID_ERR_MEMORY; } param->handle = dec; /* decode video header for frame width & height */ m4v_decode_header(dec, video_header, header_size); param->width = dec->width; param->height = dec->height; dec->mb_width = (dec->width + 15) / 16; dec->mb_height = (dec->height + 15) / 16; dec->num_mb = dec->mb_height * dec->mb_width; dec->nbits_mba = log2bin(dec->num_mb - 1); dec->edged_width = 16 * dec->mb_width + 2 * EDGE_SIZE; dec->edged_height = 16 * dec->mb_height + 2 * EDGE_SIZE; dec->decoder_clock = 0; dec->slice = xvid_malloc(sizeof(xint) * (dec->mb_width + 1) * (dec->mb_height + 1), CACHE_LINE); if (dec->slice == NULL) return XVID_ERR_MEMORY; if (image_create(&dec->cur, dec->edged_width, dec->edged_height)) { xvid_free(dec); return XVID_ERR_MEMORY; } if (image_create(&dec->refn, dec->edged_width, dec->edged_height)) { image_destroy(&dec->cur, dec->edged_width, dec->edged_height); xvid_free(dec); return XVID_ERR_MEMORY; } dec->mbs = xvid_malloc(sizeof(MACROBLOCK) * dec->mb_width * dec->mb_height, CACHE_LINE); if (dec->mbs == NULL) { image_destroy(&dec->refn, dec->edged_width, dec->edged_height); image_destroy(&dec->cur, dec->edged_width, dec->edged_height); xvid_free(dec); return XVID_ERR_MEMORY; } init_timer(); init_vlc_tables(); return XVID_ERR_OK; }