On Wed, Jul 15, 2015 at 07:48:52PM +0000, Paul B Mahol wrote: > Signed-off-by: Paul B Mahol <one...@gmail.com> [...] > +static void filter_3x3(ConvolutionContext *s, AVFrame *in, AVFrame *out, int > plane) > +{ > + const uint8_t *src = in->data[plane]; > + uint8_t *dst = out->data[plane]; > + const int stride = in->linesize[plane]; > + const int bstride = s->bstride; > + const int height = s->planeheight[plane]; > + const int width = s->planewidth[plane]; > + uint8_t *p0 = s->buffer + 16; > + uint8_t *p1 = p0 + bstride; > + uint8_t *p2 = p1 + bstride; > + uint8_t *orig = p0, *end = p2; > + const int *matrix = s->matrix[plane]; > + const float rdiv = s->rdiv; > + const float bias = s->bias; > + int y, x; > + > + line_copy8(p0, src + stride, width, 1); > + line_copy8(p1, src, width, 1); > + > + for (y = 0; y < height; y++) { > + src += stride * (y < height - 1 ? 1 : -1); > + line_copy8(p2, src, width, 1); > + > + for (x = 0; x < width; x++) { > + int sum = p0[x - 1] * matrix[0] + > + p0[x] * matrix[1] + > + p0[x + 1] * matrix[2] + > + p1[x - 1] * matrix[3] + > + p1[x] * matrix[4] + > + p1[x + 1] * matrix[5] + > + p2[x - 1] * matrix[6] + > + p2[x] * matrix[7] + > + p2[x + 1] * matrix[8]; > + sum = (int)(sum * rdiv + bias + 0.5f);
> + dst[x] = av_clip(sum, 0, 255); could use av_clip_uint8() -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope
signature.asc
Description: Digital signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel