- dst = (int16_t *)pic->data[act_plane];
- low = s->plane[plane].l_h[6];
- high = s->plane[plane].l_h[7];
- for (i = 0; i < lowpass_height; i++) {
- interlaced_vertical_filter(dst, low, high, lowpass_width * 2, pic->linesize[act_plane]/2, act_plane);
- low += lowpass_width * 2;
- high += lowpass_width * 2;
- dst += pic->linesize[act_plane];
+ if (avctx->pix_fmt == AV_PIX_FMT_BAYER_RGGB16 &&
+ (lowpass_height * 2 > avctx->coded_height / 2 ||
+ lowpass_width * 2 > avctx->coded_width / 2 )
+ ) {
+ ret = AVERROR_INVALIDDATA;
+ goto end;
+ }
+
+ low = s->plane[plane].l_h[6];
+ high = s->plane[plane].l_h[7];
+ for (i = 0; i < s->plane[act_plane].height; i++) {
+ dsp->horiz_filter_clip(dst, low, high, lowpass_width, s->bpc);
+ low += output_stride;
+ high += output_stride;
+ dst += dst_linesize;
+ }
+ } else {
+ pic->interlaced_frame = 1;
+ low = s->plane[plane].l_h[7];
+ high = s->plane[plane].subband[14];
+ output = s->plane[plane].l_h[6];
+ dsp->horiz_filter(output, output_stride, low, output_stride, high, highpass_stride, lowpass_width, lowpass_height);
+
+ low = s->plane[plane].subband[15];
+ high = s->plane[plane].subband[16];
+ output = s->plane[plane].l_h[7];
+ dsp->horiz_filter(output, output_stride, low, highpass_stride, high, highpass_stride, lowpass_width, lowpass_height);
+
+ low = s->plane[plane].l_h[9];
+ high = s->plane[plane].subband[11];
+ output = s->plane[plane].l_h[8];
+ dsp->horiz_filter(output, output_stride, low, output_stride, high, highpass_stride, lowpass_width, lowpass_height);
+
+ low = s->plane[plane].subband[12];
+ high = s->plane[plane].subband[13];
+ output = s->plane[plane].l_h[9];
+ dsp->horiz_filter(output, output_stride, low, highpass_stride, high, highpass_stride, lowpass_width, lowpass_height);
+
+ if (s->sample_type == 1)
+ continue;
+
+ dst = (int16_t *)pic->data[act_plane];
+ low = s->plane[plane].l_h[6];
+ high = s->plane[plane].l_h[7];
+ for (i = 0; i < s->plane[act_plane].height / 2; i++) {
+ interlaced_vertical_filter(dst, low, high, lowpass_width * 2, pic->linesize[act_plane]/2, act_plane);
+ low += output_stride * 2;
+ high += output_stride * 2;
+ dst += pic->linesize[act_plane];
+ }