LD ROUND1, -4, A ; (ROUND1)/16
LD F_P6, T
MAC *AR1-0, A ; + F_P6*X7
MAS *AR1-, A ; - F_P6*X4
MAS *AR1-0, A ; - F_P6*X3
MAC *AR1+, A ; + F_P6*X0
LD E_P6, T
MAS *AR1+, A ; - E_P6*X1
MAC *AR1+0, A ; + E_P6*X2
MAC *AR1+, A ; + E_P6*X5
MAS *AR1+, A ; - E_P6*X6
STH A, 6, Y66 ; Multiply prev summation by 16
; = Y66
RPTZ A, #7
MACP *AR1-, COEF_F4, A ; 64(D*X0-C*X1+B*X2-A*X3+A*X4-B*X5
SFTA A, 4 ; +C*X6-D*X7)
MAR *AR1+
ADD ROUND1, A ; + 4*ROUND1
STH A, 2, Y67 ; = Y67
MAR *+AR1(8) ; Set AR1 to point to the next set
; of 8 inputs
*********************************************************************
; *
; PROCESS EIGHTH 8 INPUTS. X(7,0)...X(7,7) -> Y(7,0)...Y(7,7) *
; *
*********************************************************************
LD *AR1+, 4, A ; + (16)*(X0)
ADD *AR1+, 4, A ; + (16)*(X1)
ADD *AR1+, 4, A ; + (16)*(X2)
ADD *AR1+, 4, A ; + (16)*(X3)
ADD *AR1+, 4, A ; + (16)*(X4)
ADD *AR1+, 4, A ; + (16)*(X5)
ADD *AR1+, 4, A ; + (16)*(X6)
ADD *AR1, 4, A ; + (16)*(X7)
STL A, Y70 ; = Y70
RPTZ A, #7
MACP *AR1-, COEF_F1, A
SFTA A, 4
MAR *AR1+ ; (64)[A*X0+B*X1+C*X2-D*X3-D*X4
ADD ROUND1, A ; -C*X5-B*X6-A*X7] + 4*ROUND1
STH A, 2, Y71 ; = Y71
LD ROUND1, -4, A ; (ROUND1)/16
LD E_P6, T
MAC *AR1+0, A ; + X0*E_P6
MAS *AR1+, A ; - X3*E_P6
MAS *AR1+0, A ; - X4*E_P6
MAC *AR1-, A ; + X7*E_P6
LD F_P6, T
MAC *AR1-, A ; + X6*F_P6
MAS *AR1-0, A ; - X5*F_P6
MAS *AR1-, A ; - X2*F_P6
MAC *AR1-, A ; + X1*F_P6
STH A, 6, Y72 ; Multiply prev summation by 16
; = Y72
RPTZ A, #7
MACP *AR1+, COEFF2, A ; 64(B*X0-D*X1-A*X2-C*X3+C*X4+A*X5
SFTA A, 4
MAR *AR1-
ADD ROUND1, A ; +D*X6-B*X7) + 4*ROUND1
STH A, 2, Y73 ; = Y73
LD *AR1-, 4, A ; X7*16
SUB *AR1-, 4, A ; - X6*16
SUB *AR1-, 4, A ; - X5*16
ADD *AR1-, 4, A ; + X4*16
ADD *AR1-, 4, A ; + X3*16
SUB *AR1-, 4, A ; - X2*16
SUB *AR1-, 4, A ; - X1*16
ADD *AR1, 4, A ; + X0*16
STL A, Y74 ; = Y74
RPTZ A, #7
MACP *AR1+, COEFF3, A ; 8(D*X0-C*X1+B*X2-A*X3+A*X4-B*X5
SFTA A, 4 ; +C*X6-D*X7)
MAR *AR1-
ADD ROUND1, A ; + 4*ROUND1
STH A, 2, Y75 ; = Y75
LD ROUND1, -4, A ; (ROUND1)/16
LD F_P6, T
MAC *AR1-0, A ; + F_P6*X7
MAS *AR1-, A ; - F_P6*X4
MAS *AR1-0, A ; - F_P6*X3
MAC *AR1+, A ; + F_P6*X0
LD E_P6, T
MAS *AR1+, A ; - E_P6*X1
MAC *AR1+0, A ; + E_P6*X2
MAC *AR1+, A ; + E_P6*X5
MAS *AR1+, A ; - E_P6*X6
STH A, 6, Y76 ; Multiply prev summation by 16
; = Y76
RPTZ A, #7
MACP *AR1-, COEF_F4, A ; 64(D*X0-C*X1+B*X2-A*X3+A*X4-B*X5
SFTA A, 4 ; +C*X6-D*X7)
MAR *AR1+
ADD ROUND1, A ; + 4*ROUND1
STH A, 2, Y77 ; = Y77
MAR *+AR1(8) ; Set AR1 to point to the next set
; of 8 inputs
; ******************************************
; * *
; * SECOND STEP : *
; * *
; * CALCULATE OUTER TRANSFORM *
; * (PROCESS INPUT COLUMNS) *
; * *
; ******************************************
DCT2 LD #PAGE25, DP
*********************************************************************
; *
; PROCESS FIRST 8 INPUTS. Y(0,0)...Y(7,0) -> Z(0,0)...Z(7,0) *
; *
*********************************************************************
LD ROUND3, A ; + ROUND3
ADD *AR2+, 9, A ; + (Y0)
ADD *AR2+, 9, A ; + (Y1)
ADD *AR2+, 9, A ; + (Y2)
ADD *AR2+, 9, A ; + (Y3)
ADD *AR2+, 9, A ; + (Y4)
ADD *AR2+, 9, A ; + (Y5)
ADD *AR2+, 9, A ; + (Y6)
ADD *AR2, 9, A ; + (Y7)
STH A, Z00 ; = Z00
RPTZ A, #7
MACP *AR2-, COEF_F1, A
SFTA A, -6
MAR *AR2+ ; (128)[A*Y0+B*Y1+C*Y2-D*Y3-D*Y4
ADD ROUND2, A ; -C*Y5-B*Y6-A*Y7] + 2*ROUND2
STH A, 1, Z10 ; = Z10
ZY20:
LD ROUND2, -6, A ; (ROUND1)/64
LD E_P7, T
MAC *AR2+0, A ; + Y0*E_P7
MAS *AR2+, A ; - Y3*E_P7
MAS *AR2+0, A ; - Y4*E_P7
MAC *AR2-, A ; + Y7*E_P7
LD F_P7, T
MAC *AR2-, A ; + Y6*F_P7
MAS *AR2-0, A ; - Y5*F_P7
MAS *AR2-, A ; - Y2*F_P7
MAC *AR2-, A ; + Y1*F_P7
STH A, -5, Z20 ; Multiply prev summation by 128
; = Z20
RPTZ A, #7
MACP *AR2+, COEFF2, A ; 128(B*Y0-D*Y1-A*Y2-C*Y3+C*Y4+A*Y5
SFTA A, -6
MAR *AR2-
ADD ROUND2, A ; +D*Y6-B*Y7) + 2*ROUND2
STH A, 1, Z30 ; = Z30
LD ROUND3, A
ADD *AR2-, 9, A ; Y7
SUB *AR2-, 9, A ; - Y6
SUB *AR2-, 9, A ; - Y5
ADD *AR2-, 9, A ; + Y4
ADD *AR2-, 9, A ; + Y3
SUB *AR2-, 9, A ; - Y2
SUB *AR2-, 9, A ; - Y1
ADD *AR2, 9, A ; + Y0
STH A, Z40 ; = Z40
RPTZ A, #7
MACP *AR2+, COEFF3, A ; 218(D*Y0-C*Y1+B*Y2-A*Y3+A*Y4-B*Y5
SFTA A, -6 ; +C*Y6-D*Y7)
MAR *AR2-
ADD ROUND2, A ; + 2*ROUND2
STH A, 1, Z50 ; = Z50
LD ROUND2, -6, A ; (ROUND1)/64
LD F_P7, T
MAC *AR2-0, A ; + F_P7*Y7
MAS *AR2-, A ; - F_P7*Y4
MAS *AR2-0, A ; - F_P7*Y3
MAC *AR2+, A ; + F_P7*Y0
LD E_P7, T
MAS *AR2+, A ; - E_P7*Y1
MAC *AR2+0, A ; + E_P7*Y2
MAC *AR2+, A ; + E_P7*Y5
MAS *AR2+, A ; - E_P7*Y6
STH A, -5, Z60 ; Multiply prev summation by 128
; = Z60
RPTZ A, #7
MACP *AR2-, COEF_F4, A ; 128(D*Y0-C*Y1+B*Y2-A*Y3+A*Y4-B*Y5
SFTA A, -6 ; +C*Y6-D*Y7)
MAR *AR2+
ADD ROUND2, A ; + 2*ROUND2
STH A, 1, Z70 ; = Z70
MAR *+AR2(8) ; Set AR2 to point to the next set
; of 8 inputs
*********************************************************************
; *
; PROCESS SECOND 8 INPUTS. Y(0,1)...Y(7,1) -> Z(0,1)...Z(7,1) *
; *
*********************************************************************
LD ROUND3, A ; + ROUND3
ADD *AR2+, 9, A ; + (Y0)
ADD *AR2+, 9, A ; + (Y1)
ADD *AR2+, 9, A ; + (Y2)
ADD *AR2+, 9, A ; + (Y3)
ADD *AR2+, 9, A ; + (Y4)
ADD *AR2+, 9, A ; + (Y5)
ADD *AR2+, 9, A ; + (Y6)
ADD *AR2, 9, A ; + (Y7)
STH A, Z01 ; = Z01
RPTZ A, #7
MACP *AR2-, COEF_F1, A
SFTA A, -6
MAR *AR2+ ; (128)[A*Y0+B*Y1+C*Y2-D*Y3-D*Y4
ADD ROUND2, A ; -C*Y5-B*Y6-A*Y7] + 2*ROUND2
STH A, 1, Z11 ; = Z11
LD ROUND2, -6, A ; (ROUND1)/64
LD E_P7, T
MAC *AR2+0, A ; + Y0*E_P7
MAS *AR2+, A ; - Y3*E_P7
MAS *AR2+0, A ; - Y4*E_P7
MAC *AR2-, A ; + Y7*E_P7
LD F_P7, T
MAC *AR2-, A ; + Y6*F_P7
MAS *AR2-0, A ; - Y5*F_P7
MAS *AR2-, A ; - Y2*F_P7
MAC *AR2-, A ; + Y1*F_P7
STH A, -5, Z21 ; Multiply prev summation by 128
; = Z21
RPTZ A, #7
MACP *AR2+, COEFF2, A ; 128(B*Y0-D*Y1-A*Y2-C*Y3+C*Y4+A*Y5
SFTA A, -6
MAR *AR2-
ADD ROUND2, A ; +D*Y6-B*Y7) + 2*ROUND2
STH A, 1, Z31 ; = Z31
LD ROUND3, A
ADD *AR2-, 9, A ; Y7
SUB *AR2-, 9, A ; - Y6
SUB *AR2-, 9, A ; - Y5
ADD *AR2-, 9, A ; + Y4
ADD *AR2-, 9, A ; + Y3
SUB *AR2-, 9, A ; - Y2
SUB *AR2-, 9, A ; - Y1
ADD *AR2, 9, A ; + Y0
STH A, Z41 ; = Z41
RPTZ A, #7
MACP *AR2+, COEFF3, A ; 218(D*Y0-C*Y1+B*Y2-A*Y3+A*Y4-B*Y5
SFTA A, -6 ; +C*Y6-D*Y7)
MAR *AR2-
ADD ROUND2, A ; + 2*ROUND2
STH A, 1, Z51 ; = Z51
LD ROUND2, -6, A ; (ROUND1)/64
LD F_P7, T
MAC *AR2-0, A ; + F_P7*X7
MAS *AR2-, A ; - F_P7*X4
MAS *AR2-0, A ; - F_P7*X3
MAC *AR2+, A ; + F_P7*X0
LD E_P7, T
MAS *AR2+, A ; - E_P7*X1
MAC *AR2+0, A ; + E_P7*X2
MAC *AR2+, A ; + E_P7*X5
MAS *AR2+, A ; - E_P7*X6
STH A, -5, Z61 ; Multiply prev summation by 128
; = Z61
RPTZ A, #7
MACP *AR2-, COEF_F4, A ; 128(D*Y0-C*Y1+B*Y2-A*Y3+A*Y4-B*Y5
SFTA A, -6 ; +C*Y6-D*Y7)
MAR *AR2+
ADD ROUND2, A ; + 2*ROUND2
STH A, 1, Z71 ; = Z71
MAR *+AR2(8) ; Set AR1 to point to the next set
; of 8 inputs
*********************************************************************
; *
; PROCESS THIRD 8 INPUTS. Y(0,2)...Y(7,2) -> Z(0,2)...Z(7,2) *
; *
*********************************************************************
LD ROUND3, A ; + ROUND3
ADD *AR2+, 9, A ; + (Y0)
ADD *AR2+, 9, A ; + (Y1)
ADD *AR2+, 9, A ; + (Y2)
ADD *AR2+, 9, A ; + (Y3)
ADD *AR2+, 9, A ; + (Y4)
ADD *AR2+, 9, A ; + (Y5)
ADD *AR2+, 9, A ; + (Y6)
ADD *AR2, 9, A ; + (Y7)
STH A, Z02 ; = Z02
RPTZ A, #7
MACP *AR2-, COEF_F1, A
SFTA A, -6
MAR *AR2+ ; (128)[A*Y0+B*Y1+C*Y2-D*Y3-D*Y4
ADD ROUND2, A ; -C*Y5-B*Y6-A*Y7] + 2*ROUND2
STH A, 1, Z12 ; = Z12
LD ROUND2, -6, A ; (ROUND1)/64
LD E_P7, T
MAC *AR2+0, A ; + Y0*E_P7
MAS *AR2+, A ; - Y3*E_P7
MAS *AR2+0, A ; - Y4*E_P7
MAC *AR2-, A ; + Y7*E_P7
LD F_P7, T
MAC *AR2-, A ; + Y6*F_P7
MAS *AR2-0, A ; - Y5*F_P7
MAS *AR2-, A ; - Y2*F_P7
MAC *AR2-, A ; + Y1*F_P7
STH A, -5, Z22 ; Multiply prev summation by 128
; = Z22
RPTZ A, #7
MACP *AR2+, COEFF2, A ; 128(B*Y0-D*Y1-A*Y2-C*Y3+C*Y4+A*Y5
SFTA A, -6
MAR *AR2-
ADD ROUND2, A ; +D*Y6-B*Y7) + 2*ROUND2
STH A, 1, Z32 ; = Z32
LD ROUND3, A
ADD *AR2-, 9, A ; Y7
SUB *AR2-, 9, A ; - Y6
SUB *AR2-, 9, A ; - Y5
ADD *AR2-, 9, A ; + Y4
ADD *AR2-, 9, A ; + Y3
SUB *AR2-, 9, A ; - Y2
SUB *AR2-, 9, A ; - Y1
ADD *AR2, 9, A ; + Y0
STH A, Z42 ; = Z42
RPTZ A, #7
MACP *AR2+, COEFF3, A ; 218(D*Y0-C*Y1+B*Y2-A*Y3+A*Y4-B*Y5
SFTA A, -6 ; +C*Y6-D*Y7)
MAR *AR2-
ADD ROUND2, A ; + 2*ROUND2
STH A, 1, Z52 ; = Z52
LD ROUND2, -6, A ; (ROUND1)/64
LD F_P7, T
MAC *AR2-0, A ; + F_P7*Y7
MAS *AR2-, A ; - F_P7*Y4
MAS *AR2-0, A ; - F_P7*Y3
MAC *AR2+, A ; + F_P7*Y0
LD E_P7, T
MAS *AR2+, A ; - E_P7*Y1
MAC *AR2+0, A ; + E_P7*Y2
MAC *AR2+, A ; + E_P7*Y5
MAS *AR2+, A ; - E_P7*Y6
STH A, -5, Z62 ; Multiply prev summation by 128
; = Z62
RPTZ A, #7
MACP *AR2-, COEF_F4, A ; 128(D*Y0-C*Y1+B*Y2-A*Y3+A*Y4-B*Y5
SFTA A, -6 ; +C*Y6-D*Y7)
MAR *AR2+
ADD ROUND2, A ; + 2*ROUND2
STH A, 1, Z72 ; = Z72
MAR *+AR2(8) ; Set AR1 to point to the next set
; of 8 inputs |