+ low = s->plane[plane].subband[0];
+ high = s->plane[plane].subband[2];
+ output = s->plane[plane].l_h[0];
+ dsp->vert_filter(output, output_stride, low, lowpass_width, high, highpass_stride, lowpass_width, lowpass_height);
+
+ low = s->plane[plane].subband[1];
+ high = s->plane[plane].subband[3];
+ output = s->plane[plane].l_h[1];
+
+ dsp->vert_filter(output, output_stride, low, highpass_stride, high, highpass_stride, lowpass_width, lowpass_height);
+
+ low = s->plane[plane].l_h[0];
+ high = s->plane[plane].l_h[1];
+ output = s->plane[plane].subband[0];
+ dsp->horiz_filter(output, output_stride, low, output_stride, high, output_stride, lowpass_width, lowpass_height * 2);
+ if (s->bpc == 12) {
+ output = s->plane[plane].subband[0];
+ for (i = 0; i < lowpass_height * 2; i++) {
+ for (j = 0; j < lowpass_width * 2; j++)
+ output[j] *= 4;
+
+ output += output_stride * 2;
+ }
+ }
+
+ /* level 2 */
+ lowpass_height = s->plane[plane].band[1][1].height;
+ output_stride = s->plane[plane].band[1][1].a_width;
+ lowpass_width = s->plane[plane].band[1][1].width;
+ highpass_stride = s->plane[plane].band[1][1].stride;
+
+ if (lowpass_height > s->plane[plane].band[1][1].a_height || lowpass_width > s->plane[plane].band[1][1].a_width ||
+ !highpass_stride || s->plane[plane].band[1][1].width > s->plane[plane].band[1][1].a_width ||
+ lowpass_width < 3 || lowpass_height < 3) {
+ av_log(avctx, AV_LOG_ERROR, "Invalid plane dimensions\n");
+ ret = AVERROR(EINVAL);
+ goto end;
+ }
+
+ av_log(avctx, AV_LOG_DEBUG, "Level 2 plane %i %i %i %i\n", plane, lowpass_height, lowpass_width, highpass_stride);
+
+ low = s->plane[plane].subband[0];
+ high = s->plane[plane].subband[5];
+ output = s->plane[plane].l_h[3];
+ dsp->vert_filter(output, output_stride, low, output_stride, high, highpass_stride, lowpass_width, lowpass_height);
+
+ low = s->plane[plane].subband[4];
+ high = s->plane[plane].subband[6];
+ 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].subband[0];
+ dsp->horiz_filter(output, output_stride, low, output_stride, high, output_stride, lowpass_width, lowpass_height * 2);