377 int ret = 0, got_buffer = 0;
386 uint16_t tagu = bytestream2_get_be16(&gb);
387 int16_t
tag = (int16_t)tagu;
388 int8_t tag8 = (int8_t)(tagu >> 8);
389 uint16_t abstag =
abs(
tag);
390 int8_t abs_tag8 =
abs(tag8);
391 uint16_t
data = bytestream2_get_be16(&gb);
394 if (abs_tag8 >= 0x60 && abs_tag8 <= 0x6f) {
398 s->progressive =
data & 0x0001;
400 s->frame_type =
data;
410 }
else if (abstag ==
Version) {
414 s->coded_width =
data;
417 s->coded_height =
data;
420 s->channel_cnt =
data;
434 s->channel_num =
data;
436 if (
s->channel_num >=
s->planes) {
443 if (
s->subband_num != 0 &&
data == 1 && (
s->transform_type == 0 ||
s->transform_type == 2))
446 s->subband_num =
data;
447 if ((
s->transform_type == 0 &&
s->level >=
DWT_LEVELS) ||
453 if (
s->subband_num > 3) {
466 if (
s->transform_type == 0 ||
s->transform_type == 2)
467 s->subband_num_actual =
data;
473 s->quantisation =
data;
476 for (
int i = 0;
i < 8;
i++)
477 s->prescale_table[
i] = (
data >> (14 -
i * 2)) & 0x3;
485 s->band_encoding =
data;
489 s->plane[
s->channel_num].band[0][0].width =
data;
490 s->plane[
s->channel_num].band[0][0].stride =
data;
493 s->plane[
s->channel_num].band[0][0].height =
data;
495 s->sample_type =
data;
502 }
else if (
data == 1) {
507 if (
s->transform_type == -1) {
508 s->transform_type =
data;
513 }
else if (abstag >= 0x4000 && abstag <= 0x40ff) {
514 if (abstag == 0x4001)
520 s->frame_index =
data;
528 for (
int i = 0;
i <
data;
i++) {
529 uint32_t
offset = bytestream2_get_be32(&gb);
533 av_log(avctx,
AV_LOG_DEBUG,
"Highpass width %i channel %i level %i subband %i\n",
data,
s->channel_num,
s->level,
s->subband_num);
539 s->plane[
s->channel_num].band[
s->level][
s->subband_num].width =
data;
540 s->plane[
s->channel_num].band[
s->level][
s->subband_num].stride =
FFALIGN(
data, 8);
548 s->plane[
s->channel_num].band[
s->level][
s->subband_num].height =
data;
556 s->plane[
s->channel_num].band[
s->level][
s->subband_num].width =
data;
557 s->plane[
s->channel_num].band[
s->level][
s->subband_num].stride =
FFALIGN(
data, 8);
565 s->plane[
s->channel_num].band[
s->level][
s->subband_num].height =
data;
572 }
else if (
data >= 122 &&
data <= 128) {
574 }
else if (
data == 30) {
582 s->codebook =
data & 0xf;
583 s->difference_coding = (
data >> 4) & 1;
597 }
else if (
data == 2) {
599 }
else if (
data == 3) {
601 }
else if (
data == 4) {
611 s->cropped_height =
data;
613 s->peak.offset &= ~0xffff;
614 s->peak.offset |= (
data & 0xffff);
618 s->peak.offset &= 0xffff;
619 s->peak.offset |= (
data & 0xffffU)<<16;
623 s->peak.level =
data;
636 int lowpass_height =
s->plane[
s->channel_num].band[0][0].height;
637 int lowpass_width =
s->plane[
s->channel_num].band[0][0].width;
640 if (
s->coded_width) {
644 if (
s->coded_height) {
648 if (!
s->a_width && !
s->coded_width) {
649 s->coded_width = lowpass_width *
factor * 8;
652 if (!
s->a_height && !
s->coded_height) {
653 s->coded_height = lowpass_height *
factor * 8;
656 if (
s->a_width && !
s->coded_width)
657 s->coded_width =
s->a_width;
658 if (
s->a_height && !
s->coded_height)
659 s->coded_height =
s->a_height;
661 if (
s->a_width !=
s->coded_width ||
s->a_height !=
s->coded_height ||
662 s->a_format !=
s->coded_format ||
663 s->transform_type !=
s->a_transform_type) {
673 if (
s->cropped_height) {
699 if (
s->subband_num_actual == 255)
703 if (
s->transform_type !=
s->a_transform_type)
706 coeff_data =
s->plane[
s->channel_num].subband[
s->subband_num_actual];
710 int lowpass_height, lowpass_width, lowpass_a_height, lowpass_a_width;
712 if (!
s->a_width || !
s->a_height) {
717 lowpass_height =
s->plane[
s->channel_num].band[0][0].height;
718 lowpass_width =
s->plane[
s->channel_num].band[0][0].width;
719 lowpass_a_height =
s->plane[
s->channel_num].band[0][0].a_height;
720 lowpass_a_width =
s->plane[
s->channel_num].band[0][0].a_width;
722 if (lowpass_width < 3 ||
723 lowpass_width > lowpass_a_width) {
729 if (lowpass_height < 3 ||
730 lowpass_height > lowpass_a_height) {
742 if (lowpass_height > lowpass_a_height || lowpass_width > lowpass_a_width ||
749 av_log(avctx,
AV_LOG_DEBUG,
"Start of lowpass coeffs component %d height:%d, width:%d\n",
s->channel_num, lowpass_height, lowpass_width);
750 for (
int i = 0;
i < lowpass_height;
i++) {
751 for (
int j = 0; j < lowpass_width; j++)
752 coeff_data[j] = bytestream2_get_be16u(&gb);
754 coeff_data += lowpass_width;
761 if (lowpass_height & 1) {
762 memcpy(&coeff_data[lowpass_height * lowpass_width],
763 &coeff_data[(lowpass_height - 1) * lowpass_width],
764 lowpass_width *
sizeof(*coeff_data));
767 s->plane[
s->channel_num].band[0][0].read_ok = 1;
769 av_log(avctx,
AV_LOG_DEBUG,
"Lowpass coefficients %d\n", lowpass_width * lowpass_height);
774 int highpass_height, highpass_width, highpass_a_width, highpass_a_height, highpass_stride, a_expected;
777 int count = 0, bytes;
779 if (!
s->a_width || !
s->a_height) {
784 highpass_height =
s->plane[
s->channel_num].band[
s->level][
s->subband_num].height;
785 highpass_width =
s->plane[
s->channel_num].band[
s->level][
s->subband_num].width;
786 highpass_a_width =
s->plane[
s->channel_num].band[
s->level][
s->subband_num].a_width;
787 highpass_a_height =
s->plane[
s->channel_num].band[
s->level][
s->subband_num].a_height;
788 highpass_stride =
s->plane[
s->channel_num].band[
s->level][
s->subband_num].stride;
789 a_expected = highpass_a_height * highpass_a_width;
797 if (highpass_height > highpass_a_height || highpass_width > highpass_a_width || a_expected < highpass_height * (uint64_t)highpass_stride) {
802 expected = highpass_height * highpass_stride;
804 av_log(avctx,
AV_LOG_DEBUG,
"Start subband coeffs plane %i level %i codebook %i expected %i\n",
s->channel_num,
s->level,
s->codebook, expected);
812 const int lossless =
s->band_encoding == 5;
814 if (
s->codebook == 0 &&
s->transform_type == 2 &&
s->subband_num_actual == 7)
830 if (count > expected)
838 const uint16_t q =
s->quantisation;
840 for (
int i = 0;
i <
run;
i++) {
841 *coeff_data |=
coeff * 256U;
845 for (
int i = 0;
i <
run;
i++)
846 *coeff_data++ =
coeff;
863 if (count > expected)
871 const uint16_t q =
s->quantisation;
873 for (
int i = 0;
i <
run;
i++) {
874 *coeff_data |=
coeff * 256U;
878 for (
int i = 0;
i <
run;
i++)
879 *coeff_data++ =
coeff;
886 if (count > expected) {
893 if (
s->difference_coding)
894 difference_coding(
s->plane[
s->channel_num].subband[
s->subband_num_actual], highpass_width, highpass_height);
904 av_log(avctx,
AV_LOG_DEBUG,
"End subband coeffs %i extra %i\n", count, count - expected);
905 s->plane[
s->channel_num].band[
s->level][
s->subband_num].read_ok = 1;
907 if (
s->subband_num_actual != 255)
921 s->a_transform_type == INT_MIN ||
934 for (
int plane = 0; plane <
s->planes; plane++) {
936 if (
s->transform_type == 2)
939 for (
int o = !!
level; o < 4 ; o++) {
940 if (!
s->plane[plane].band[
level][o].read_ok) {
948 if (
s->transform_type == 0 &&
s->sample_type != 1) {
949 for (
int plane = 0; plane <
s->planes && !ret; plane++) {
951 int lowpass_height =
s->plane[plane].band[0][0].height;
952 int output_stride =
s->plane[plane].band[0][0].a_width;
953 int lowpass_width =
s->plane[plane].band[0][0].width;
954 int highpass_stride =
s->plane[plane].band[0][1].stride;
955 int act_plane = plane == 1 ? 2 : plane == 2 ? 1 : plane;
956 ptrdiff_t dst_linesize;
957 int16_t *low, *
high, *output, *
dst;
961 dst_linesize = pic->
linesize[act_plane];
963 dst_linesize = pic->
linesize[act_plane] / 2;
966 if (lowpass_height >
s->plane[plane].band[0][0].a_height || lowpass_width >
s->plane[plane].band[0][0].a_width ||
967 !highpass_stride ||
s->plane[plane].band[0][1].width >
s->plane[plane].band[0][1].a_width ||
968 lowpass_width < 3 || lowpass_height < 3) {
974 av_log(avctx,
AV_LOG_DEBUG,
"Decoding level 1 plane %i %i %i %i\n", plane, lowpass_height, lowpass_width, highpass_stride);
976 low =
s->plane[plane].subband[0];
977 high =
s->plane[plane].subband[2];
978 output =
s->plane[plane].l_h[0];
979 dsp->
vert_filter(output, output_stride, low, lowpass_width,
high, highpass_stride, lowpass_width, lowpass_height);
981 low =
s->plane[plane].subband[1];
982 high =
s->plane[plane].subband[3];
983 output =
s->plane[plane].l_h[1];
985 dsp->
vert_filter(output, output_stride, low, highpass_stride,
high, highpass_stride, lowpass_width, lowpass_height);
987 low =
s->plane[plane].l_h[0];
988 high =
s->plane[plane].l_h[1];
989 output =
s->plane[plane].subband[0];
990 dsp->
horiz_filter(output, output_stride, low, output_stride,
high, output_stride, lowpass_width, lowpass_height * 2);
992 output =
s->plane[plane].subband[0];
993 for (
int i = 0;
i < lowpass_height * 2;
i++) {
994 for (
int j = 0; j < lowpass_width * 2; j++)
997 output += output_stride * 2;
1002 lowpass_height =
s->plane[plane].band[1][1].height;
1003 output_stride =
s->plane[plane].band[1][1].a_width;
1004 lowpass_width =
s->plane[plane].band[1][1].width;
1005 highpass_stride =
s->plane[plane].band[1][1].stride;
1007 if (lowpass_height >
s->plane[plane].band[1][1].a_height || lowpass_width >
s->plane[plane].band[1][1].a_width ||
1008 !highpass_stride ||
s->plane[plane].band[1][1].width >
s->plane[plane].band[1][1].a_width ||
1009 lowpass_width < 3 || lowpass_height < 3) {
1015 av_log(avctx,
AV_LOG_DEBUG,
"Level 2 plane %i %i %i %i\n", plane, lowpass_height, lowpass_width, highpass_stride);
1017 low =
s->plane[plane].subband[0];
1018 high =
s->plane[plane].subband[5];
1019 output =
s->plane[plane].l_h[3];
1020 dsp->
vert_filter(output, output_stride, low, output_stride,
high, highpass_stride, lowpass_width, lowpass_height);
1022 low =
s->plane[plane].subband[4];
1023 high =
s->plane[plane].subband[6];
1024 output =
s->plane[plane].l_h[4];
1025 dsp->
vert_filter(output, output_stride, low, highpass_stride,
high, highpass_stride, lowpass_width, lowpass_height);
1027 low =
s->plane[plane].l_h[3];
1028 high =
s->plane[plane].l_h[4];
1029 output =
s->plane[plane].subband[0];
1030 dsp->
horiz_filter(output, output_stride, low, output_stride,
high, output_stride, lowpass_width, lowpass_height * 2);
1032 output =
s->plane[plane].subband[0];
1033 for (
int i = 0;
i < lowpass_height * 2;
i++) {
1034 for (
int j = 0; j < lowpass_width * 2; j++)
1037 output += output_stride * 2;
1041 lowpass_height =
s->plane[plane].band[2][1].height;
1042 output_stride =
s->plane[plane].band[2][1].a_width;
1043 lowpass_width =
s->plane[plane].band[2][1].width;
1044 highpass_stride =
s->plane[plane].band[2][1].stride;
1046 if (lowpass_height >
s->plane[plane].band[2][1].a_height || lowpass_width >
s->plane[plane].band[2][1].a_width ||
1047 !highpass_stride ||
s->plane[plane].band[2][1].width >
s->plane[plane].band[2][1].a_width ||
1048 lowpass_height < 3 || lowpass_width < 3 || lowpass_width * 2 >
s->plane[plane].width) {
1054 av_log(avctx,
AV_LOG_DEBUG,
"Level 3 plane %i %i %i %i\n", plane, lowpass_height, lowpass_width, highpass_stride);
1055 if (
s->progressive) {
1056 low =
s->plane[plane].subband[0];
1057 high =
s->plane[plane].subband[8];
1058 output =
s->plane[plane].l_h[6];
1059 dsp->
vert_filter(output, output_stride, low, output_stride,
high, highpass_stride, lowpass_width, lowpass_height);
1061 low =
s->plane[plane].subband[7];
1062 high =
s->plane[plane].subband[9];
1063 output =
s->plane[plane].l_h[7];
1064 dsp->
vert_filter(output, output_stride, low, highpass_stride,
high, highpass_stride, lowpass_width, lowpass_height);
1066 dst = (int16_t *)pic->
data[act_plane];
1073 low =
s->plane[plane].l_h[6];
1074 high =
s->plane[plane].l_h[7];
1084 for (
int i = 0;
i <
s->plane[act_plane].height;
i++) {
1088 low += output_stride;
1089 high += output_stride;
1090 dst += dst_linesize;
1095 low =
s->plane[plane].subband[0];
1096 high =
s->plane[plane].subband[7];
1097 output =
s->plane[plane].l_h[6];
1098 dsp->
horiz_filter(output, output_stride, low, output_stride,
high, highpass_stride, lowpass_width, lowpass_height);
1100 low =
s->plane[plane].subband[8];
1101 high =
s->plane[plane].subband[9];
1102 output =
s->plane[plane].l_h[7];
1103 dsp->
horiz_filter(output, output_stride, low, highpass_stride,
high, highpass_stride, lowpass_width, lowpass_height);
1105 dst = (int16_t *)pic->
data[act_plane];
1106 low =
s->plane[plane].l_h[6];
1107 high =
s->plane[plane].l_h[7];
1108 for (
int i = 0;
i <
s->plane[act_plane].height / 2;
i++) {
1110 low += output_stride * 2;
1111 high += output_stride * 2;
1116 }
else if (
s->transform_type == 2 && (avctx->
internal->
is_copy ||
s->frame_index == 1 ||
s->sample_type != 1)) {
1117 for (
int plane = 0; plane <
s->planes && !ret; plane++) {
1118 int lowpass_height =
s->plane[plane].band[0][0].height;
1119 int output_stride =
s->plane[plane].band[0][0].a_width;
1120 int lowpass_width =
s->plane[plane].band[0][0].width;
1121 int highpass_stride =
s->plane[plane].band[0][1].stride;
1122 int act_plane = plane == 1 ? 2 : plane == 2 ? 1 : plane;
1123 int16_t *low, *
high, *output, *
dst;
1124 ptrdiff_t dst_linesize;
1128 dst_linesize = pic->
linesize[act_plane];
1130 dst_linesize = pic->
linesize[act_plane] / 2;
1133 if (lowpass_height >
s->plane[plane].band[0][0].a_height || lowpass_width >
s->plane[plane].band[0][0].a_width ||
1134 !highpass_stride ||
s->plane[plane].band[0][1].width >
s->plane[plane].band[0][1].a_width ||
1135 lowpass_width < 3 || lowpass_height < 3) {
1141 av_log(avctx,
AV_LOG_DEBUG,
"Decoding level 1 plane %i %i %i %i\n", plane, lowpass_height, lowpass_width, highpass_stride);
1143 low =
s->plane[plane].subband[0];
1144 high =
s->plane[plane].subband[2];
1145 output =
s->plane[plane].l_h[0];
1146 dsp->
vert_filter(output, output_stride, low, lowpass_width,
high, highpass_stride, lowpass_width, lowpass_height);
1148 low =
s->plane[plane].subband[1];
1149 high =
s->plane[plane].subband[3];
1150 output =
s->plane[plane].l_h[1];
1151 dsp->
vert_filter(output, output_stride, low, highpass_stride,
high, highpass_stride, lowpass_width, lowpass_height);
1153 low =
s->plane[plane].l_h[0];
1154 high =
s->plane[plane].l_h[1];
1155 output =
s->plane[plane].l_h[7];
1156 dsp->
horiz_filter(output, output_stride, low, output_stride,
high, output_stride, lowpass_width, lowpass_height * 2);
1158 output =
s->plane[plane].l_h[7];
1159 for (
int i = 0;
i < lowpass_height * 2;
i++) {
1160 for (
int j = 0; j < lowpass_width * 2; j++)
1163 output += output_stride * 2;
1167 lowpass_height =
s->plane[plane].band[1][1].height;
1168 output_stride =
s->plane[plane].band[1][1].a_width;
1169 lowpass_width =
s->plane[plane].band[1][1].width;
1170 highpass_stride =
s->plane[plane].band[1][1].stride;
1172 if (lowpass_height >
s->plane[plane].band[1][1].a_height || lowpass_width >
s->plane[plane].band[1][1].a_width ||
1173 !highpass_stride ||
s->plane[plane].band[1][1].width >
s->plane[plane].band[1][1].a_width ||
1174 lowpass_width < 3 || lowpass_height < 3) {
1180 av_log(avctx,
AV_LOG_DEBUG,
"Level 2 lowpass plane %i %i %i %i\n", plane, lowpass_height, lowpass_width, highpass_stride);
1182 low =
s->plane[plane].l_h[7];
1183 high =
s->plane[plane].subband[5];
1184 output =
s->plane[plane].l_h[3];
1185 dsp->
vert_filter(output, output_stride, low, output_stride,
high, highpass_stride, lowpass_width, lowpass_height);
1187 low =
s->plane[plane].subband[4];
1188 high =
s->plane[plane].subband[6];
1189 output =
s->plane[plane].l_h[4];
1190 dsp->
vert_filter(output, output_stride, low, highpass_stride,
high, highpass_stride, lowpass_width, lowpass_height);
1192 low =
s->plane[plane].l_h[3];
1193 high =
s->plane[plane].l_h[4];
1194 output =
s->plane[plane].l_h[7];
1195 dsp->
horiz_filter(output, output_stride, low, output_stride,
high, output_stride, lowpass_width, lowpass_height * 2);
1197 output =
s->plane[plane].l_h[7];
1198 for (
int i = 0;
i < lowpass_height * 2;
i++) {
1199 for (
int j = 0; j < lowpass_width * 2; j++)
1201 output += output_stride * 2;
1204 low =
s->plane[plane].subband[7];
1205 high =
s->plane[plane].subband[9];
1206 output =
s->plane[plane].l_h[3];
1207 dsp->
vert_filter(output, output_stride, low, highpass_stride,
high, highpass_stride, lowpass_width, lowpass_height);
1209 low =
s->plane[plane].subband[8];
1210 high =
s->plane[plane].subband[10];
1211 output =
s->plane[plane].l_h[4];
1212 dsp->
vert_filter(output, output_stride, low, highpass_stride,
high, highpass_stride, lowpass_width, lowpass_height);
1214 low =
s->plane[plane].l_h[3];
1215 high =
s->plane[plane].l_h[4];
1216 output =
s->plane[plane].l_h[9];
1217 dsp->
horiz_filter(output, output_stride, low, output_stride,
high, output_stride, lowpass_width, lowpass_height * 2);
1219 lowpass_height =
s->plane[plane].band[4][1].height;
1220 output_stride =
s->plane[plane].band[4][1].a_width;
1221 lowpass_width =
s->plane[plane].band[4][1].width;
1222 highpass_stride =
s->plane[plane].band[4][1].stride;
1223 av_log(avctx,
AV_LOG_DEBUG,
"temporal level %i %i %i %i\n", plane, lowpass_height, lowpass_width, highpass_stride);
1225 if (lowpass_height >
s->plane[plane].band[4][1].a_height || lowpass_width >
s->plane[plane].band[4][1].a_width ||
1226 !highpass_stride ||
s->plane[plane].band[4][1].width >
s->plane[plane].band[4][1].a_width ||
1227 lowpass_width < 3 || lowpass_height < 3 || lowpass_width * 2 >
s->plane[plane].width) {
1233 low =
s->plane[plane].l_h[7];
1234 high =
s->plane[plane].l_h[9];
1235 output =
s->plane[plane].l_h[7];
1236 for (
int i = 0;
i < lowpass_height;
i++) {
1238 low += output_stride;
1239 high += output_stride;
1241 if (
s->progressive) {
1242 low =
s->plane[plane].l_h[7];
1243 high =
s->plane[plane].subband[15];
1244 output =
s->plane[plane].l_h[6];
1245 dsp->
vert_filter(output, output_stride, low, output_stride,
high, highpass_stride, lowpass_width, lowpass_height);
1247 low =
s->plane[plane].subband[14];
1248 high =
s->plane[plane].subband[16];
1249 output =
s->plane[plane].l_h[7];
1250 dsp->
vert_filter(output, output_stride, low, highpass_stride,
high, highpass_stride, lowpass_width, lowpass_height);
1252 low =
s->plane[plane].l_h[9];
1253 high =
s->plane[plane].subband[12];
1254 output =
s->plane[plane].l_h[8];
1255 dsp->
vert_filter(output, output_stride, low, output_stride,
high, highpass_stride, lowpass_width, lowpass_height);
1257 low =
s->plane[plane].subband[11];
1258 high =
s->plane[plane].subband[13];
1259 output =
s->plane[plane].l_h[9];
1260 dsp->
vert_filter(output, output_stride, low, highpass_stride,
high, highpass_stride, lowpass_width, lowpass_height);
1262 if (
s->sample_type == 1)
1265 dst = (int16_t *)pic->
data[act_plane];
1281 low =
s->plane[plane].l_h[6];
1282 high =
s->plane[plane].l_h[7];
1283 for (
int i = 0;
i <
s->plane[act_plane].height;
i++) {
1285 low += output_stride;
1286 high += output_stride;
1287 dst += dst_linesize;
1291 low =
s->plane[plane].l_h[7];
1292 high =
s->plane[plane].subband[14];
1293 output =
s->plane[plane].l_h[6];
1294 dsp->
horiz_filter(output, output_stride, low, output_stride,
high, highpass_stride, lowpass_width, lowpass_height);
1296 low =
s->plane[plane].subband[15];
1297 high =
s->plane[plane].subband[16];
1298 output =
s->plane[plane].l_h[7];
1299 dsp->
horiz_filter(output, output_stride, low, highpass_stride,
high, highpass_stride, lowpass_width, lowpass_height);
1301 low =
s->plane[plane].l_h[9];
1302 high =
s->plane[plane].subband[11];
1303 output =
s->plane[plane].l_h[8];
1304 dsp->
horiz_filter(output, output_stride, low, output_stride,
high, highpass_stride, lowpass_width, lowpass_height);
1306 low =
s->plane[plane].subband[12];
1307 high =
s->plane[plane].subband[13];
1308 output =
s->plane[plane].l_h[9];
1309 dsp->
horiz_filter(output, output_stride, low, highpass_stride,
high, highpass_stride, lowpass_width, lowpass_height);
1311 if (
s->sample_type == 1)
1314 dst = (int16_t *)pic->
data[act_plane];
1315 low =
s->plane[plane].l_h[6];
1316 high =
s->plane[plane].l_h[7];
1317 for (
int i = 0;
i <
s->plane[act_plane].height / 2;
i++) {
1319 low += output_stride * 2;
1320 high += output_stride * 2;
1327 if (
s->transform_type == 2 &&
s->sample_type == 1) {
1329 int output_stride, lowpass_height, lowpass_width;
1330 ptrdiff_t dst_linesize;
1332 for (
int plane = 0; plane <
s->planes; plane++) {
1333 int act_plane = plane == 1 ? 2 : plane == 2 ? 1 : plane;
1337 dst_linesize = pic->
linesize[act_plane];
1339 dst_linesize = pic->
linesize[act_plane] / 2;
1342 lowpass_height =
s->plane[plane].band[4][1].height;
1343 output_stride =
s->plane[plane].band[4][1].a_width;
1344 lowpass_width =
s->plane[plane].band[4][1].width;
1346 if (lowpass_height >
s->plane[plane].band[4][1].a_height || lowpass_width >
s->plane[plane].band[4][1].a_width ||
1347 s->plane[plane].band[4][1].width >
s->plane[plane].band[4][1].a_width ||
1348 lowpass_width < 3 || lowpass_height < 3 || lowpass_width * 2 >
s->plane[plane].width) {
1354 if (
s->progressive) {
1355 dst = (int16_t *)pic->
data[act_plane];
1356 low =
s->plane[plane].l_h[8];
1357 high =
s->plane[plane].l_h[9];
1374 for (
int i = 0;
i <
s->plane[act_plane].height;
i++) {
1376 low += output_stride;
1377 high += output_stride;
1378 dst += dst_linesize;
1381 dst = (int16_t *)pic->
data[act_plane];
1382 low =
s->plane[plane].l_h[8];
1383 high =
s->plane[plane].l_h[9];
1384 for (
int i = 0;
i <
s->plane[act_plane].height / 2;
i++) {
1386 low += output_stride * 2;
1387 high += output_stride * 2;