55 #define OFFSET(x) offsetof(HistogramContext, x)
56 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
70 {
"waveform_mirror",
"set waveform mirroring",
OFFSET(waveform_mirror),
AV_OPT_TYPE_INT, {.i64=0}, 0, 1,
FLAGS,
"waveform_mirror"},
173 outlink->
h = outlink->
w = 256;
185 int component,
int intensity,
int offset,
int col_mode)
189 const int is_chroma = (component == 1 || component == 2);
192 const int src_linesize = inpicref->
linesize[plane];
193 const int dst_linesize = outpicref->
linesize[plane];
194 const int dst_signed_linesize = dst_linesize * (mirror == 1 ? -1 : 1);
196 uint8_t *dst_data = outpicref->
data[plane] + (col_mode ? (offset >> shift_h) * dst_linesize : offset >> shift_w);
197 uint8_t *
const dst_bottom_line = dst_data + dst_linesize * ((256 >> shift_h) - 1);
198 uint8_t *
const dst_line = (mirror ? dst_bottom_line : dst_data);
199 const uint8_t max = 255 - intensity;
205 if (!col_mode && mirror)
206 dst_data += 256 >> shift_w;
207 for (y = 0; y < src_h; y++) {
208 const uint8_t *src_data_end = src_data + src_w;
210 for (p = src_data; p < src_data_end; p++) {
213 target = dst++ + dst_signed_linesize * (*p >> shift_h);
216 target = dst_data - (*p >> shift_w);
218 target = dst_data + (*p >> shift_w);
221 *target += intensity;
225 src_data += src_linesize;
226 dst_data += dst_linesize;
249 for (k = 0; k < h->
ncomp; k++) {
250 const int is_chroma = (k == 1 || k == 2);
253 for (i = 0; i < dst_h ; i++)
261 for (k = 0; k < h->
ncomp; k++) {
265 unsigned max_hval = 0;
269 for (j = 0; j < in->
width; j++)
273 for (i = 0; i < 256; i++)
275 max_hval_log =
log2(max_hval + 1);
277 for (i = 0; i < outlink->
w; i++) {
287 for (l = 0; l < h->
ncomp; l++)
297 memset(h->
histogram, 0, 256 *
sizeof(
unsigned));
301 for (k = 0; k < h->
ncomp; k++) {
307 for (i = 0; i < inlink->
h; i++) {
308 const int iw1 = i * in->
linesize[1];
309 const int iw2 = i * in->
linesize[2];
310 for (j = 0; j < inlink->
w; j++) {
311 const int pos = in->
data[1][iw1 + j] * out->
linesize[0] + in->
data[2][iw2 + j];
312 if (out->
data[0][pos] < 255)
316 for (i = 0; i < 256; i++) {
318 for (j = 0; j < 256; j++) {
327 for (i = 0; i < inlink->
h; i++) {
328 const int iw1 = i * in->
linesize[1];
329 const int iw2 = i * in->
linesize[2];
330 for (j = 0; j < inlink->
w; j++) {
331 const int u = in->
data[1][iw1 + j];
332 const int v = in->
data[2][iw2 + j];
333 const int pos = u * out->
linesize[0] +
v;
334 if (!out->
data[0][pos])
336 out->
data[1][pos] =
u;
337 out->
data[2][pos] =
v;
375 .priv_class = &histogram_class,