+ low = s->plane[plane].subband[7];
+ high = s->plane[plane].subband[9];
+ output = s->plane[plane].l_h[3];
+ dsp->vert_filter(output, output_stride, low, highpass_stride, high, highpass_stride, lowpass_width, lowpass_height);
+
+ low = s->plane[plane].subband[8];
+ high = s->plane[plane].subband[10];
+ output = s->plane[plane].l_h[4];
+ dsp->vert_filter(output, output_stride, low, highpass_stride, high, highpass_stride, lowpass_width, lowpass_height);
+
+ low = s->plane[plane].l_h[3];
+ high = s->plane[plane].l_h[4];
+ output = s->plane[plane].l_h[9];
+ dsp->horiz_filter(output, output_stride, low, output_stride, high, output_stride, lowpass_width, lowpass_height * 2);
+
+ lowpass_height = s->plane[plane].band[4][1].height;
+ output_stride = s->plane[plane].band[4][1].a_width;
+ lowpass_width = s->plane[plane].band[4][1].width;
+ highpass_stride = s->plane[plane].band[4][1].stride;
+ av_log(avctx, AV_LOG_DEBUG, "temporal level %i %i %i %i\n", plane, lowpass_height, lowpass_width, highpass_stride);
+
+ if (lowpass_height > s->plane[plane].band[4][1].a_height || lowpass_width > s->plane[plane].band[4][1].a_width ||
+ !highpass_stride || s->plane[plane].band[4][1].width > s->plane[plane].band[4][1].a_width ||
+ lowpass_width < 3 || lowpass_height < 3) {
+ av_log(avctx, AV_LOG_ERROR, "Invalid plane dimensions\n");
+ ret = AVERROR(EINVAL);
+ goto end;
+ }
+
+ low = s->plane[plane].l_h[7];
+ high = s->plane[plane].l_h[9];
+ output = s->plane[plane].l_h[7];
+ for (i = 0; i < lowpass_height; i++) {
+ inverse_temporal_filter(low, high, lowpass_width);
+ low += output_stride;
+ high += output_stride;
+ }
+ if (s->progressive) {
+ low = s->plane[plane].l_h[7];
+ high = s->plane[plane].subband[15];
+ output = s->plane[plane].l_h[6];
+ dsp->vert_filter(output, output_stride, low, output_stride, high, highpass_stride, lowpass_width, lowpass_height);
+
+ low = s->plane[plane].subband[14];
+ high = s->plane[plane].subband[16];
+ output = s->plane[plane].l_h[7];
+ dsp->vert_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[12];
+ output = s->plane[plane].l_h[8];
+ dsp->vert_filter(output, output_stride, low, output_stride, high, highpass_stride, lowpass_width, lowpass_height);
+
+ low = s->plane[plane].subband[11];
+ high = s->plane[plane].subband[13];
+ output = s->plane[plane].l_h[9];
+ dsp->vert_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];
+ if (avctx->pix_fmt == AV_PIX_FMT_BAYER_RGGB16) {
+ if (plane & 1)
+ dst++;
+ if (plane > 1)
+ dst += pic->linesize[act_plane] >> 1;
+ }
+
+ 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];
+ }
+ }