Originally committed as revision 522 to svn://svn.ffmpeg.org/ffmpeg/trunktags/v0.5
| @@ -19,7 +19,6 @@ | |||||
| //#define DEBUG | //#define DEBUG | ||||
| //#define DEBUG_BITALLOC | //#define DEBUG_BITALLOC | ||||
| #include "avcodec.h" | #include "avcodec.h" | ||||
| #include <math.h> | |||||
| #include "ac3enc.h" | #include "ac3enc.h" | ||||
| #include "ac3tab.h" | #include "ac3tab.h" | ||||
| @@ -19,7 +19,6 @@ | |||||
| * alternative bitstream reader & writer by Michael Niedermayer <michaelni@gmx.at> | * alternative bitstream reader & writer by Michael Niedermayer <michaelni@gmx.at> | ||||
| */ | */ | ||||
| #include "common.h" | #include "common.h" | ||||
| #include <math.h> | |||||
| void init_put_bits(PutBitContext *s, | void init_put_bits(PutBitContext *s, | ||||
| UINT8 *buffer, int buffer_size, | UINT8 *buffer, int buffer_size, | ||||
| @@ -444,10 +443,8 @@ int init_vlc(VLC *vlc, int nb_bits, int nb_codes, | |||||
| bits, bits_wrap, bits_size, | bits, bits_wrap, bits_size, | ||||
| codes, codes_wrap, codes_size, | codes, codes_wrap, codes_size, | ||||
| 0, 0) < 0) { | 0, 0) < 0) { | ||||
| if (vlc->table_bits) | |||||
| free(vlc->table_bits); | |||||
| if (vlc->table_codes) | |||||
| free(vlc->table_codes); | |||||
| av_free(vlc->table_bits); | |||||
| av_free(vlc->table_codes); | |||||
| return -1; | return -1; | ||||
| } | } | ||||
| return 0; | return 0; | ||||
| @@ -456,8 +453,8 @@ int init_vlc(VLC *vlc, int nb_bits, int nb_codes, | |||||
| void free_vlc(VLC *vlc) | void free_vlc(VLC *vlc) | ||||
| { | { | ||||
| free(vlc->table_bits); | |||||
| free(vlc->table_codes); | |||||
| av_free(vlc->table_bits); | |||||
| av_free(vlc->table_codes); | |||||
| } | } | ||||
| int ff_gcd(int a, int b){ | int ff_gcd(int a, int b){ | ||||
| @@ -18,9 +18,6 @@ | |||||
| * | * | ||||
| * gmc & q-pel & 32/64 bit based MC by Michael Niedermayer <michaelni@gmx.at> | * gmc & q-pel & 32/64 bit based MC by Michael Niedermayer <michaelni@gmx.at> | ||||
| */ | */ | ||||
| #include <stdlib.h> | |||||
| #include <stdio.h> | |||||
| #include <math.h> | |||||
| #include "avcodec.h" | #include "avcodec.h" | ||||
| #include "dsputil.h" | #include "dsputil.h" | ||||
| #include "simple_idct.h" | #include "simple_idct.h" | ||||
| @@ -1553,11 +1553,11 @@ void init_rl(RLTable *rl) | |||||
| if (run > max_run[level]) | if (run > max_run[level]) | ||||
| max_run[level] = run; | max_run[level] = run; | ||||
| } | } | ||||
| rl->max_level[last] = malloc(MAX_RUN + 1); | |||||
| rl->max_level[last] = av_malloc(MAX_RUN + 1); | |||||
| memcpy(rl->max_level[last], max_level, MAX_RUN + 1); | memcpy(rl->max_level[last], max_level, MAX_RUN + 1); | ||||
| rl->max_run[last] = malloc(MAX_LEVEL + 1); | |||||
| rl->max_run[last] = av_malloc(MAX_LEVEL + 1); | |||||
| memcpy(rl->max_run[last], max_run, MAX_LEVEL + 1); | memcpy(rl->max_run[last], max_run, MAX_LEVEL + 1); | ||||
| rl->index_run[last] = malloc(MAX_RUN + 1); | |||||
| rl->index_run[last] = av_malloc(MAX_RUN + 1); | |||||
| memcpy(rl->index_run[last], index_run, MAX_RUN + 1); | memcpy(rl->index_run[last], index_run, MAX_RUN + 1); | ||||
| } | } | ||||
| } | } | ||||
| @@ -16,11 +16,8 @@ | |||||
| * along with this program; if not, write to the Free Software | * along with this program; if not, write to the Free Software | ||||
| * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||||
| */ | */ | ||||
| #include <stdlib.h> | |||||
| #include <stdio.h> | |||||
| #include <string.h> | |||||
| #include "dsputil.h" | |||||
| #include "avcodec.h" | #include "avcodec.h" | ||||
| #include "dsputil.h" | |||||
| #include "mpegvideo.h" | #include "mpegvideo.h" | ||||
| //#define DEBUG | //#define DEBUG | ||||
| @@ -481,7 +481,7 @@ static void deinterlace_bottom_field(UINT8 *dst, int dst_wrap, | |||||
| int y, y1, i; | int y, y1, i; | ||||
| UINT8 *buf; | UINT8 *buf; | ||||
| buf= (UINT8*) malloc(5 * width); | |||||
| buf = (UINT8*)av_malloc(5 * width); | |||||
| src = src1; | src = src1; | ||||
| for(y=0;y<height;y+=2) { | for(y=0;y<height;y+=2) { | ||||
| @@ -511,7 +511,7 @@ static void deinterlace_bottom_field(UINT8 *dst, int dst_wrap, | |||||
| dst += dst_wrap; | dst += dst_wrap; | ||||
| src += (2 + 1) * src_wrap; | src += (2 + 1) * src_wrap; | ||||
| } | } | ||||
| free(buf); | |||||
| av_free(buf); | |||||
| } | } | ||||
| @@ -16,12 +16,8 @@ | |||||
| * along with this program; if not, write to the Free Software | * along with this program; if not, write to the Free Software | ||||
| * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||||
| */ | */ | ||||
| #include <stdlib.h> | |||||
| #include <stdio.h> | |||||
| #include <string.h> | |||||
| #include <math.h> | |||||
| #include "dsputil.h" | |||||
| #include "avcodec.h" | #include "avcodec.h" | ||||
| #include "dsputil.h" | |||||
| #ifdef USE_FASTMEMCPY | #ifdef USE_FASTMEMCPY | ||||
| #include "fastmemcpy.h" | #include "fastmemcpy.h" | ||||
| @@ -454,7 +450,7 @@ ImgReSampleContext *img_resample_init(int owidth, int oheight, | |||||
| return s; | return s; | ||||
| fail: | fail: | ||||
| free(s); | |||||
| av_free(s); | |||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| @@ -474,8 +470,8 @@ void img_resample(ImgReSampleContext *s, | |||||
| void img_resample_close(ImgReSampleContext *s) | void img_resample_close(ImgReSampleContext *s) | ||||
| { | { | ||||
| free(s->line_buf); | |||||
| free(s); | |||||
| av_free(s->line_buf); | |||||
| av_free(s); | |||||
| } | } | ||||
| #ifdef TEST | #ifdef TEST | ||||
| @@ -23,10 +23,6 @@ | |||||
| #include "avcodec.h" | #include "avcodec.h" | ||||
| #include "dsputil.h" | #include "dsputil.h" | ||||
| #include "mpegvideo.h" | #include "mpegvideo.h" | ||||
| #include "common.h" | |||||
| #include <string.h> | |||||
| #include <stdio.h> | |||||
| #ifdef USE_FASTMEMCPY | #ifdef USE_FASTMEMCPY | ||||
| #include "fastmemcpy.h" | #include "fastmemcpy.h" | ||||
| @@ -246,7 +242,7 @@ int mjpeg_init(MpegEncContext *s) | |||||
| { | { | ||||
| MJpegContext *m; | MJpegContext *m; | ||||
| m = malloc(sizeof(MJpegContext)); | |||||
| m = av_malloc(sizeof(MJpegContext)); | |||||
| if (!m) | if (!m) | ||||
| return -1; | return -1; | ||||
| @@ -278,7 +274,7 @@ int mjpeg_init(MpegEncContext *s) | |||||
| void mjpeg_close(MpegEncContext *s) | void mjpeg_close(MpegEncContext *s) | ||||
| { | { | ||||
| free(s->mjpeg_ctx); | |||||
| av_free(s->mjpeg_ctx); | |||||
| } | } | ||||
| static inline void put_marker(PutBitContext *p, int code) | static inline void put_marker(PutBitContext *p, int code) | ||||
| @@ -777,10 +773,8 @@ static int mjpeg_decode_sof0(MJpegDecodeContext *s, | |||||
| /* if different size, realloc/alloc picture */ | /* if different size, realloc/alloc picture */ | ||||
| /* XXX: also check h_count and v_count */ | /* XXX: also check h_count and v_count */ | ||||
| if (width != s->width || height != s->height) { | if (width != s->width || height != s->height) { | ||||
| for(i=0;i<MAX_COMPONENTS;i++) { | |||||
| free(s->current_picture[i]); | |||||
| s->current_picture[i] = NULL; | |||||
| } | |||||
| for(i=0;i<MAX_COMPONENTS;i++) | |||||
| av_freep(&s->current_picture[i]); | |||||
| s->width = width; | s->width = width; | ||||
| s->height = height; | s->height = height; | ||||
| /* test interlaced mode */ | /* test interlaced mode */ | ||||
| @@ -1128,7 +1122,7 @@ static int mjpeg_decode_com(MJpegDecodeContext *s, | |||||
| /* XXX: verify len field validity */ | /* XXX: verify len field validity */ | ||||
| len = get_bits(&s->gb, 16)-2; | len = get_bits(&s->gb, 16)-2; | ||||
| cbuf = malloc(len+1); | |||||
| cbuf = av_malloc(len+1); | |||||
| for (i = 0; i < len; i++) | for (i = 0; i < len; i++) | ||||
| cbuf[i] = get_bits(&s->gb, 8); | cbuf[i] = get_bits(&s->gb, 8); | ||||
| @@ -1147,7 +1141,7 @@ static int mjpeg_decode_com(MJpegDecodeContext *s, | |||||
| printf("mjpeg: workarounding buggy AVID\n"); | printf("mjpeg: workarounding buggy AVID\n"); | ||||
| } | } | ||||
| free(cbuf); | |||||
| av_free(cbuf); | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| @@ -1332,7 +1326,7 @@ static int mjpeg_decode_end(AVCodecContext *avctx) | |||||
| int i, j; | int i, j; | ||||
| for(i=0;i<MAX_COMPONENTS;i++) | for(i=0;i<MAX_COMPONENTS;i++) | ||||
| free(s->current_picture[i]); | |||||
| av_free(s->current_picture[i]); | |||||
| for(i=0;i<2;i++) { | for(i=0;i<2;i++) { | ||||
| for(j=0;j<4;j++) | for(j=0;j<4;j++) | ||||
| free_vlc(&s->vlcs[i][j]); | free_vlc(&s->vlcs[i][j]); | ||||
| @@ -18,7 +18,6 @@ | |||||
| */ | */ | ||||
| #include "avcodec.h" | #include "avcodec.h" | ||||
| #include <math.h> | |||||
| #include "mpegaudio.h" | #include "mpegaudio.h" | ||||
| #include <lame/lame.h> | #include <lame/lame.h> | ||||
| @@ -17,7 +17,6 @@ | |||||
| * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||||
| */ | */ | ||||
| #include "avcodec.h" | #include "avcodec.h" | ||||
| #include <math.h> | |||||
| #include "mpegaudio.h" | #include "mpegaudio.h" | ||||
| /* currently, cannot change these constants (need to modify | /* currently, cannot change these constants (need to modify | ||||
| @@ -18,10 +18,6 @@ | |||||
| * | * | ||||
| * 4MV & hq & b-frame encoding stuff by Michael Niedermayer <michaelni@gmx.at> | * 4MV & hq & b-frame encoding stuff by Michael Niedermayer <michaelni@gmx.at> | ||||
| */ | */ | ||||
| #include <stdlib.h> | |||||
| #include <stdio.h> | |||||
| #include <math.h> | |||||
| #include <string.h> | |||||
| #include "avcodec.h" | #include "avcodec.h" | ||||
| #include "dsputil.h" | #include "dsputil.h" | ||||
| #include "mpegvideo.h" | #include "mpegvideo.h" | ||||
| @@ -264,7 +260,7 @@ int MPV_common_init(MpegEncContext *s) | |||||
| int size; | int size; | ||||
| /* MV prediction */ | /* MV prediction */ | ||||
| size = (2 * s->mb_width + 2) * (2 * s->mb_height + 2); | size = (2 * s->mb_width + 2) * (2 * s->mb_height + 2); | ||||
| s->motion_val = malloc(size * 2 * sizeof(INT16)); | |||||
| s->motion_val = av_malloc(size * 2 * sizeof(INT16)); | |||||
| if (s->motion_val == NULL) | if (s->motion_val == NULL) | ||||
| goto fail; | goto fail; | ||||
| memset(s->motion_val, 0, size * 2 * sizeof(INT16)); | memset(s->motion_val, 0, size * 2 * sizeof(INT16)); | ||||
| @@ -278,7 +274,7 @@ int MPV_common_init(MpegEncContext *s) | |||||
| y_size = (2 * s->mb_width + 2) * (2 * s->mb_height + 2); | y_size = (2 * s->mb_width + 2) * (2 * s->mb_height + 2); | ||||
| c_size = (s->mb_width + 2) * (s->mb_height + 2); | c_size = (s->mb_width + 2) * (s->mb_height + 2); | ||||
| size = y_size + 2 * c_size; | size = y_size + 2 * c_size; | ||||
| s->dc_val[0] = malloc(size * sizeof(INT16)); | |||||
| s->dc_val[0] = av_malloc(size * sizeof(INT16)); | |||||
| if (s->dc_val[0] == NULL) | if (s->dc_val[0] == NULL) | ||||
| goto fail; | goto fail; | ||||
| s->dc_val[1] = s->dc_val[0] + y_size; | s->dc_val[1] = s->dc_val[0] + y_size; | ||||
| @@ -326,44 +322,38 @@ int MPV_common_init(MpegEncContext *s) | |||||
| return -1; | return -1; | ||||
| } | } | ||||
| #define CHECK_FREE(p)\ | |||||
| {\ | |||||
| if(p) free(p);\ | |||||
| p= NULL;\ | |||||
| } | |||||
| /* init common structure for both encoder and decoder */ | /* init common structure for both encoder and decoder */ | ||||
| void MPV_common_end(MpegEncContext *s) | void MPV_common_end(MpegEncContext *s) | ||||
| { | { | ||||
| int i; | int i; | ||||
| CHECK_FREE(s->mb_type); | |||||
| CHECK_FREE(s->mb_var); | |||||
| CHECK_FREE(s->p_mv_table); | |||||
| CHECK_FREE(s->last_p_mv_table); | |||||
| CHECK_FREE(s->b_forw_mv_table); | |||||
| CHECK_FREE(s->b_back_mv_table); | |||||
| CHECK_FREE(s->b_bidir_forw_mv_table); | |||||
| CHECK_FREE(s->b_bidir_back_mv_table); | |||||
| CHECK_FREE(s->b_direct_forw_mv_table); | |||||
| CHECK_FREE(s->b_direct_back_mv_table); | |||||
| CHECK_FREE(s->b_direct_mv_table); | |||||
| CHECK_FREE(s->motion_val); | |||||
| CHECK_FREE(s->dc_val[0]); | |||||
| CHECK_FREE(s->ac_val[0]); | |||||
| CHECK_FREE(s->coded_block); | |||||
| CHECK_FREE(s->mbintra_table); | |||||
| CHECK_FREE(s->me_scratchpad); | |||||
| CHECK_FREE(s->mbskip_table); | |||||
| CHECK_FREE(s->bitstream_buffer); | |||||
| av_freep(&s->mb_type); | |||||
| av_freep(&s->mb_var); | |||||
| av_freep(&s->p_mv_table); | |||||
| av_freep(&s->last_p_mv_table); | |||||
| av_freep(&s->b_forw_mv_table); | |||||
| av_freep(&s->b_back_mv_table); | |||||
| av_freep(&s->b_bidir_forw_mv_table); | |||||
| av_freep(&s->b_bidir_back_mv_table); | |||||
| av_freep(&s->b_direct_forw_mv_table); | |||||
| av_freep(&s->b_direct_back_mv_table); | |||||
| av_freep(&s->b_direct_mv_table); | |||||
| av_freep(&s->motion_val); | |||||
| av_freep(&s->dc_val[0]); | |||||
| av_freep(&s->ac_val[0]); | |||||
| av_freep(&s->coded_block); | |||||
| av_freep(&s->mbintra_table); | |||||
| av_freep(&s->me_scratchpad); | |||||
| av_freep(&s->mbskip_table); | |||||
| av_freep(&s->bitstream_buffer); | |||||
| for(i=0;i<3;i++) { | for(i=0;i<3;i++) { | ||||
| int j; | int j; | ||||
| CHECK_FREE(s->last_picture_base[i]); | |||||
| CHECK_FREE(s->next_picture_base[i]); | |||||
| CHECK_FREE(s->aux_picture_base[i]); | |||||
| av_freep(&s->last_picture_base[i]); | |||||
| av_freep(&s->next_picture_base[i]); | |||||
| av_freep(&s->aux_picture_base[i]); | |||||
| for(j=0; j<REORDER_BUFFER_SIZE; j++){ | for(j=0; j<REORDER_BUFFER_SIZE; j++){ | ||||
| CHECK_FREE(s->picture_buffer[j][i]); | |||||
| av_freep(&s->picture_buffer[j][i]); | |||||
| } | } | ||||
| } | } | ||||
| s->context_initialized = 0; | s->context_initialized = 0; | ||||
| @@ -16,12 +16,9 @@ | |||||
| * along with this program; if not, write to the Free Software | * along with this program; if not, write to the Free Software | ||||
| * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||||
| */ | */ | ||||
| #include <stdlib.h> | |||||
| #include <stdio.h> | |||||
| #include "common.h" | |||||
| #include "avcodec.h" | |||||
| #include "dsputil.h" | #include "dsputil.h" | ||||
| #include "mpegvideo.h" | #include "mpegvideo.h" | ||||
| #include "avcodec.h" | |||||
| /* | /* | ||||
| * You can also call this codec : MPEG4 with a twist ! | * You can also call this codec : MPEG4 with a twist ! | ||||
| @@ -137,7 +134,7 @@ static void init_mv_table(MVTable *tab) | |||||
| { | { | ||||
| int i, x, y; | int i, x, y; | ||||
| tab->table_mv_index = malloc(sizeof(UINT16) * 4096); | |||||
| tab->table_mv_index = av_malloc(sizeof(UINT16) * 4096); | |||||
| /* mark all entries as not used */ | /* mark all entries as not used */ | ||||
| for(i=0;i<4096;i++) | for(i=0;i<4096;i++) | ||||
| tab->table_mv_index[i] = tab->n; | tab->table_mv_index[i] = tab->n; | ||||
| @@ -109,7 +109,7 @@ static int encode_init(AVCodecContext *avctx) | |||||
| switch(avctx->codec->id) { | switch(avctx->codec->id) { | ||||
| case CODEC_ID_PCM_ALAW: | case CODEC_ID_PCM_ALAW: | ||||
| if (linear_to_alaw_ref == 0) { | if (linear_to_alaw_ref == 0) { | ||||
| linear_to_alaw = malloc(16384); | |||||
| linear_to_alaw = av_malloc(16384); | |||||
| if (!linear_to_alaw) | if (!linear_to_alaw) | ||||
| return -1; | return -1; | ||||
| build_xlaw_table(linear_to_alaw, alaw2linear, 0xd5); | build_xlaw_table(linear_to_alaw, alaw2linear, 0xd5); | ||||
| @@ -118,7 +118,7 @@ static int encode_init(AVCodecContext *avctx) | |||||
| break; | break; | ||||
| case CODEC_ID_PCM_MULAW: | case CODEC_ID_PCM_MULAW: | ||||
| if (linear_to_ulaw_ref == 0) { | if (linear_to_ulaw_ref == 0) { | ||||
| linear_to_ulaw = malloc(16384); | |||||
| linear_to_ulaw = av_malloc(16384); | |||||
| if (!linear_to_ulaw) | if (!linear_to_ulaw) | ||||
| return -1; | return -1; | ||||
| build_xlaw_table(linear_to_ulaw, ulaw2linear, 0xff); | build_xlaw_table(linear_to_ulaw, ulaw2linear, 0xff); | ||||
| @@ -136,11 +136,11 @@ static int encode_close(AVCodecContext *avctx) | |||||
| switch(avctx->codec->id) { | switch(avctx->codec->id) { | ||||
| case CODEC_ID_PCM_ALAW: | case CODEC_ID_PCM_ALAW: | ||||
| if (--linear_to_alaw_ref == 0) | if (--linear_to_alaw_ref == 0) | ||||
| free(linear_to_alaw); | |||||
| av_free(linear_to_alaw); | |||||
| break; | break; | ||||
| case CODEC_ID_PCM_MULAW: | case CODEC_ID_PCM_MULAW: | ||||
| if (--linear_to_ulaw_ref == 0) | if (--linear_to_ulaw_ref == 0) | ||||
| free(linear_to_ulaw); | |||||
| av_free(linear_to_ulaw); | |||||
| break; | break; | ||||
| default: | default: | ||||
| /* nothing to free */ | /* nothing to free */ | ||||
| @@ -106,10 +106,10 @@ void ff_rate_control_uninit(MpegEncContext *s) | |||||
| RateControlContext *rcc= &s->rc_context; | RateControlContext *rcc= &s->rc_context; | ||||
| emms_c(); | emms_c(); | ||||
| if(rcc->stats_file) fclose(rcc->stats_file); | |||||
| if(rcc->entry) free(rcc->entry); | |||||
| rcc->stats_file= NULL; | |||||
| rcc->entry= NULL; | |||||
| if(rcc->stats_file) | |||||
| fclose(rcc->stats_file); | |||||
| rcc->stats_file = NULL; | |||||
| av_freep(&rcc->entry); | |||||
| } | } | ||||
| //---------------------------------- | //---------------------------------- | ||||
| @@ -17,7 +17,6 @@ | |||||
| * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||||
| */ | */ | ||||
| #include "avcodec.h" | #include "avcodec.h" | ||||
| #include <math.h> | |||||
| typedef struct { | typedef struct { | ||||
| /* fractional resampling */ | /* fractional resampling */ | ||||
| @@ -193,7 +192,7 @@ static int mono_resample(ReSampleChannelContext *s, short *output, short *input, | |||||
| short *buf1; | short *buf1; | ||||
| short *buftmp; | short *buftmp; | ||||
| buf1= (short*) malloc( nb_samples * sizeof(short) ); | |||||
| buf1= (short*)av_malloc( nb_samples * sizeof(short) ); | |||||
| /* first downsample by an integer factor with averaging filter */ | /* first downsample by an integer factor with averaging filter */ | ||||
| if (s->iratio > 1) { | if (s->iratio > 1) { | ||||
| @@ -209,7 +208,7 @@ static int mono_resample(ReSampleChannelContext *s, short *output, short *input, | |||||
| } else { | } else { | ||||
| memcpy(output, buftmp, nb_samples * sizeof(short)); | memcpy(output, buftmp, nb_samples * sizeof(short)); | ||||
| } | } | ||||
| free(buf1); | |||||
| av_free(buf1); | |||||
| return nb_samples; | return nb_samples; | ||||
| } | } | ||||
| @@ -260,13 +259,13 @@ int audio_resample(ReSampleContext *s, short *output, short *input, int nb_sampl | |||||
| } | } | ||||
| /* XXX: move those malloc to resample init code */ | /* XXX: move those malloc to resample init code */ | ||||
| bufin[0]= (short*) malloc( nb_samples * sizeof(short) ); | |||||
| bufin[1]= (short*) malloc( nb_samples * sizeof(short) ); | |||||
| bufin[0]= (short*) av_malloc( nb_samples * sizeof(short) ); | |||||
| bufin[1]= (short*) av_malloc( nb_samples * sizeof(short) ); | |||||
| /* make some zoom to avoid round pb */ | /* make some zoom to avoid round pb */ | ||||
| lenout= (int)(nb_samples * s->ratio) + 16; | lenout= (int)(nb_samples * s->ratio) + 16; | ||||
| bufout[0]= (short*) malloc( lenout * sizeof(short) ); | |||||
| bufout[1]= (short*) malloc( lenout * sizeof(short) ); | |||||
| bufout[0]= (short*) av_malloc( lenout * sizeof(short) ); | |||||
| bufout[1]= (short*) av_malloc( lenout * sizeof(short) ); | |||||
| if (s->input_channels == 2 && | if (s->input_channels == 2 && | ||||
| s->output_channels == 1) { | s->output_channels == 1) { | ||||
| @@ -299,15 +298,15 @@ int audio_resample(ReSampleContext *s, short *output, short *input, int nb_sampl | |||||
| stereo_mux(output, buftmp3[0], buftmp3[1], nb_samples1); | stereo_mux(output, buftmp3[0], buftmp3[1], nb_samples1); | ||||
| } | } | ||||
| free(bufin[0]); | |||||
| free(bufin[1]); | |||||
| av_free(bufin[0]); | |||||
| av_free(bufin[1]); | |||||
| free(bufout[0]); | |||||
| free(bufout[1]); | |||||
| av_free(bufout[0]); | |||||
| av_free(bufout[1]); | |||||
| return nb_samples1; | return nb_samples1; | ||||
| } | } | ||||
| void audio_resample_close(ReSampleContext *s) | void audio_resample_close(ReSampleContext *s) | ||||
| { | { | ||||
| free(s); | |||||
| av_free(s); | |||||
| } | } | ||||
| @@ -16,12 +16,8 @@ | |||||
| * along with this program; if not, write to the Free Software | * along with this program; if not, write to the Free Software | ||||
| * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||||
| */ | */ | ||||
| #include <stdlib.h> | |||||
| #include <stdio.h> | |||||
| #include <string.h> | |||||
| #include "common.h" | |||||
| #include "dsputil.h" | |||||
| #include "avcodec.h" | #include "avcodec.h" | ||||
| #include "dsputil.h" | |||||
| #include "mpegvideo.h" | #include "mpegvideo.h" | ||||
| //#define DEBUG | //#define DEBUG | ||||
| @@ -20,10 +20,9 @@ | |||||
| based upon some outcommented c code from mpeg2dec (idct_mmx.c written by Aaron Holtzman <aholtzma@ess.engr.uvic.ca>) | based upon some outcommented c code from mpeg2dec (idct_mmx.c written by Aaron Holtzman <aholtzma@ess.engr.uvic.ca>) | ||||
| */ | */ | ||||
| #include <inttypes.h> | |||||
| #include "avcodec.h" | |||||
| #include "simple_idct.h" | #include "simple_idct.h" | ||||
| #include "../config.h" | |||||
| #if 0 | #if 0 | ||||
| #define W1 2841 /* 2048*sqrt (2)*cos (1*pi/16) */ | #define W1 2841 /* 2048*sqrt (2)*cos (1*pi/16) */ | ||||