Mercurial > libavcodec.hg
comparison bitstream_filter.c @ 5035:32cd5a37161b libavcodec
move noise bitstream filter in its own file
author | aurel |
---|---|
date | Sat, 19 May 2007 00:30:15 +0000 |
parents | b955154b7ca9 |
children | 06f4c436a09f |
comparison
equal
deleted
inserted
replaced
5034:b955154b7ca9 | 5035:32cd5a37161b |
---|---|
104 *poutbuf_size= buf_size; | 104 *poutbuf_size= buf_size; |
105 | 105 |
106 return 0; | 106 return 0; |
107 } | 107 } |
108 | 108 |
109 static int noise(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args, | |
110 uint8_t **poutbuf, int *poutbuf_size, | |
111 const uint8_t *buf, int buf_size, int keyframe){ | |
112 int amount= args ? atoi(args) : 10000; | |
113 unsigned int *state= bsfc->priv_data; | |
114 int i; | |
115 | |
116 *poutbuf= av_malloc(buf_size + FF_INPUT_BUFFER_PADDING_SIZE); | |
117 | |
118 memcpy(*poutbuf, buf, buf_size + FF_INPUT_BUFFER_PADDING_SIZE); | |
119 for(i=0; i<buf_size; i++){ | |
120 (*state) += (*poutbuf)[i] + 1; | |
121 if(*state % amount == 0) | |
122 (*poutbuf)[i] = *state; | |
123 } | |
124 return 1; | |
125 } | |
126 | |
127 #ifdef CONFIG_DUMP_EXTRADATA_BSF | 109 #ifdef CONFIG_DUMP_EXTRADATA_BSF |
128 AVBitStreamFilter dump_extradata_bsf={ | 110 AVBitStreamFilter dump_extradata_bsf={ |
129 "dump_extra", | 111 "dump_extra", |
130 0, | 112 0, |
131 dump_extradata, | 113 dump_extradata, |
137 "remove_extra", | 119 "remove_extra", |
138 0, | 120 0, |
139 remove_extradata, | 121 remove_extradata, |
140 }; | 122 }; |
141 #endif | 123 #endif |
142 | |
143 #ifdef CONFIG_NOISE_BSF | |
144 AVBitStreamFilter noise_bsf={ | |
145 "noise", | |
146 sizeof(int), | |
147 noise, | |
148 }; | |
149 #endif |