Lines Matching defs:cellauto
83 AVFILTER_DEFINE_CLASS(cellauto);
88 CellAutoContext *cellauto = ctx->priv;
90 uint8_t *row = cellauto->buf + cellauto->w * cellauto->buf_row_idx;
91 char *line = av_malloc(cellauto->w + 1);
95 for (i = 0; i < cellauto->w; i++)
98 av_log(ctx, AV_LOG_DEBUG, "generation:%"PRId64" row:%s|\n", cellauto->generation, line);
105 CellAutoContext *cellauto = ctx->priv;
109 w = strlen(cellauto->pattern);
112 if (cellauto->w) {
113 if (w > cellauto->w) {
116 cellauto->w, w);
121 cellauto->w = w;
122 cellauto->h = (double)cellauto->w * M_PHI;
125 cellauto->buf = av_mallocz_array(sizeof(uint8_t) * cellauto->w, cellauto->h);
126 if (!cellauto->buf)
130 p = cellauto->pattern;
131 for (i = (cellauto->w - w)/2;; i++) {
136 cellauto->buf[i] = !!av_isgraph(*(p++));
144 CellAutoContext *cellauto = ctx->priv;
147 ret = av_file_map(cellauto->filename,
148 &cellauto->file_buf, &cellauto->file_bufsize, 0, ctx);
153 cellauto->pattern = av_malloc(cellauto->file_bufsize + 1);
154 if (!cellauto->pattern)
156 memcpy(cellauto->pattern, cellauto->file_buf, cellauto->file_bufsize);
157 cellauto->pattern[cellauto->file_bufsize] = 0;
164 CellAutoContext *cellauto = ctx->priv;
167 if (!cellauto->w && !cellauto->filename && !cellauto->pattern)
168 av_opt_set(cellauto, "size", "320x518", 0);
170 if (cellauto->filename && cellauto->pattern) {
175 if (cellauto->filename) {
178 } else if (cellauto->pattern) {
185 cellauto->buf = av_mallocz_array(sizeof(uint8_t) * cellauto->w, cellauto->h);
186 if (!cellauto->buf)
188 if (cellauto->random_seed == -1)
189 cellauto->random_seed = av_get_random_seed();
191 av_lfg_init(&cellauto->lfg, cellauto->random_seed);
193 for (i = 0; i < cellauto->w; i++) {
194 double r = (double)av_lfg_get(&cellauto->lfg) / UINT32_MAX;
195 if (r <= cellauto->random_fill_ratio)
196 cellauto->buf[i] = 1;
202 cellauto->w, cellauto->h, cellauto->frame_rate.num, cellauto->frame_rate.den,
203 cellauto->rule, cellauto->stitch, cellauto->scroll, cellauto->start_full,
204 cellauto->random_seed);
210 CellAutoContext *cellauto = ctx->priv;
212 av_file_unmap(cellauto->file_buf, cellauto->file_bufsize);
213 av_freep(&cellauto->buf);
214 av_freep(&cellauto->pattern);
219 CellAutoContext *cellauto = outlink->src->priv;
221 outlink->w = cellauto->w;
222 outlink->h = cellauto->h;
223 outlink->time_base = av_inv_q(cellauto->frame_rate);
230 CellAutoContext *cellauto = ctx->priv;
232 uint8_t *row, *prev_row = cellauto->buf + cellauto->buf_row_idx * cellauto->w;
235 cellauto->buf_prev_row_idx = cellauto->buf_row_idx;
236 cellauto->buf_row_idx = cellauto->buf_row_idx == cellauto->h-1 ? 0 : cellauto->buf_row_idx+1;
237 row = cellauto->buf + cellauto->w * cellauto->buf_row_idx;
239 for (i = 0; i < cellauto->w; i++) {
240 if (cellauto->stitch) {
241 pos[NW] = i-1 < 0 ? cellauto->w-1 : i-1;
243 pos[NE] = i+1 == cellauto->w ? 0 : i+1;
249 v|= i+1 < cellauto->w ? prev_row[i+1] : 0;
251 row[i] = !!(cellauto->rule & (1<<v));
256 cellauto->generation++;
261 CellAutoContext *cellauto = ctx->priv;
265 if (cellauto->scroll && cellauto->generation >= cellauto->h)
267 row_idx = (cellauto->buf_row_idx + 1) % cellauto->h;
270 for (i = 0; i < cellauto->h; i++) {
272 uint8_t *row = cellauto->buf + row_idx*cellauto->w;
274 for (k = 0, j = 0; j < cellauto->w; j++) {
276 if (k==8 || j == cellauto->w-1) {
282 row_idx = (row_idx + 1) % cellauto->h;
289 CellAutoContext *cellauto = outlink->src->priv;
290 AVFrame *picref = ff_get_video_buffer(outlink, cellauto->w, cellauto->h);
294 if (cellauto->generation == 0 && cellauto->start_full) {
296 for (i = 0; i < cellauto->h-1; i++)
302 picref->pts = cellauto->pts++;
328 .name = "cellauto",