Lines Matching defs:elbg
26 #include "libavcodec/elbg.h"
63 AVFILTER_DEFINE_CLASS(elbg);
67 ELBGContext *elbg = ctx->priv;
69 if (elbg->lfg_seed == -1)
70 elbg->lfg_seed = av_get_random_seed();
72 av_lfg_init(&elbg->lfg, elbg->lfg_seed);
94 ELBGContext *elbg = ctx->priv;
96 elbg->pix_desc = av_pix_fmt_desc_get(inlink->format);
97 elbg->codeword_length = inlink->w * inlink->h;
98 elbg->codeword = av_realloc_f(elbg->codeword, elbg->codeword_length,
99 NB_COMPONENTS * sizeof(*elbg->codeword));
100 if (!elbg->codeword)
103 elbg->codeword_closest_codebook_idxs =
104 av_realloc_f(elbg->codeword_closest_codebook_idxs, elbg->codeword_length,
105 sizeof(*elbg->codeword_closest_codebook_idxs));
106 if (!elbg->codeword_closest_codebook_idxs)
109 elbg->codebook = av_realloc_f(elbg->codebook, elbg->codebook_length,
110 NB_COMPONENTS * sizeof(*elbg->codebook));
111 if (!elbg->codebook)
114 ff_fill_rgba_map(elbg->rgba_map, inlink->format);
125 ELBGContext *elbg = inlink->dst->priv;
129 const uint8_t r_idx = elbg->rgba_map[R];
130 const uint8_t g_idx = elbg->rgba_map[G];
131 const uint8_t b_idx = elbg->rgba_map[B];
139 elbg->codeword[k++] = p[r_idx];
140 elbg->codeword[k++] = p[g_idx];
141 elbg->codeword[k++] = p[b_idx];
142 p += elbg->pix_desc->nb_components;
148 avpriv_init_elbg(elbg->codeword, NB_COMPONENTS, elbg->codeword_length,
149 elbg->codebook, elbg->codebook_length, elbg->max_steps_nb,
150 elbg->codeword_closest_codebook_idxs, &elbg->lfg);
151 avpriv_do_elbg(elbg->codeword, NB_COMPONENTS, elbg->codeword_length,
152 elbg->codebook, elbg->codebook_length, elbg->max_steps_nb,
153 elbg->codeword_closest_codebook_idxs, &elbg->lfg);
162 int cb_idx = NB_COMPONENTS * elbg->codeword_closest_codebook_idxs[k++];
163 p[r_idx] = elbg->codebook[cb_idx];
164 p[g_idx] = elbg->codebook[cb_idx+1];
165 p[b_idx] = elbg->codebook[cb_idx+2];
166 p += elbg->pix_desc->nb_components;
176 ELBGContext *elbg = ctx->priv;
178 av_freep(&elbg->codebook);
179 av_freep(&elbg->codeword);
180 av_freep(&elbg->codeword_closest_codebook_idxs);
203 .name = "elbg",