Revision cd7105e6 libavcodec/bitstream_filter.c

View differences:

libavcodec/bitstream_filter.c
106 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 109
#ifdef CONFIG_DUMP_EXTRADATA_BSF
128 110
AVBitStreamFilter dump_extradata_bsf={
129 111
    "dump_extra",
......
139 121
    remove_extradata,
140 122
};
141 123
#endif
142

  
143
#ifdef CONFIG_NOISE_BSF
144
AVBitStreamFilter noise_bsf={
145
    "noise",
146
    sizeof(int),
147
    noise,
148
};
149
#endif

Also available in: Unified diff