recon.s 3.52 KB
#include "recon.h"

/*
Inputs:

	rec_in_dat	- Input IDCT'ed data address
	rec_in_ref	- Reference block address
	rec_in_cbp	- Coded Block Pattern
	rec_in_intra	- Intra block flag
	
Outputs:	

	data at rec_out_dat	- reconstructed data
*/


recon:
	addi	caddr, rzero, RECON_CONSTS
	lqv	consts[0], 0(caddr)

	addi	loopcnt, rzero, 12
	

recon_loop:
	blez	loopcnt, recon_ret
	addi	loopcnt, loopcnt, -2
	addi	uvflag,	loopcnt, -2
	andi	dummy, rec_in_cbp, 1
	blez	dummy, recon_next
	srl	rec_in_cbp, rec_in_cbp, 1
	bgtz	rec_in_intra, recon_noref
	nop
	bgtz	uvflag, recon_y
	nop
	
recon_uv:
	lhv	ref_r0[0], 0(rec_in_ref)
	lhv	ref_r1[0], 16(rec_in_ref)
	lhv	ref_r2[0], 32(rec_in_ref)
	lhv	ref_r3[0], 48(rec_in_ref)
	lhv	ref_r4[0], 64(rec_in_ref)
	lhv	ref_r5[0], 80(rec_in_ref)
	lhv	ref_r6[0], 96(rec_in_ref)
	j	shift_lo	
	lhv	ref_r7[0], 112(rec_in_ref)
		
recon_y:
	luv	ref_r0[0],  0(rec_in_ref)
	luv	ref_r1[0], 16(rec_in_ref)
	luv	ref_r2[0], 32(rec_in_ref)
	luv	ref_r3[0], 48(rec_in_ref)
	luv	ref_r4[0], 64(rec_in_ref)
	luv	ref_r5[0], 80(rec_in_ref)
	luv	ref_r6[0], 96(rec_in_ref)
	luv	ref_r7[0], 112(rec_in_ref)

	
shift_lo:	
	vmudm	ref_r0, ref_r0, consts[SHIFTDN]
	vmudm	ref_r1, ref_r1, consts[SHIFTDN]	
	vmudm	ref_r2, ref_r2, consts[SHIFTDN]	
	vmudm	ref_r3, ref_r3, consts[SHIFTDN]	
				lqv	err_r0[0], 0(rec_in_dat)
	vmudm	ref_r4, ref_r4, consts[SHIFTDN]	
				lqv	err_r1[0], 16(rec_in_dat)
	vmudm	ref_r5, ref_r5, consts[SHIFTDN]	
				lqv	err_r2[0], 32(rec_in_dat)
	vmudm	ref_r6, ref_r6, consts[SHIFTDN]
				lqv	err_r3[0], 48(rec_in_dat)
	vmudm	ref_r7, ref_r7, consts[SHIFTDN]

				lqv	err_r4[0], 64(rec_in_dat)
	vadd	ref_r0, ref_r0, err_r0
				lqv	err_r5[0], 80(rec_in_dat)
	vadd	ref_r1, ref_r1, err_r1
				lqv	err_r6[0], 96(rec_in_dat)
	vadd	ref_r2, ref_r2, err_r2
				lqv	err_r7[0], 112(rec_in_dat)
	vadd	ref_r3, ref_r3, err_r3
	vadd	ref_r4, ref_r4, err_r4
	vadd	ref_r5, ref_r5, err_r5
	vadd	ref_r6, ref_r6, err_r6
	vadd	ref_r7, ref_r7, err_r7
		

shift_hi:
				sqv	vzero[0], 0(rec_in_dat)
	vmudn	ref_r0, ref_r0, consts[SHIFTUP]
				sqv	vzero[0], 16(rec_in_dat)
	vmudn	ref_r1, ref_r1, consts[SHIFTUP]
				sqv	vzero[0], 32(rec_in_dat)
	vmudn	ref_r2, ref_r2, consts[SHIFTUP]
				sqv	vzero[0], 48(rec_in_dat)
	vmudn	ref_r3, ref_r3, consts[SHIFTUP]
				sqv	vzero[0], 64(rec_in_dat)
	vmudn	ref_r4, ref_r4, consts[SHIFTUP]
				sqv	vzero[0], 80(rec_in_dat)
	vmudn	ref_r5, ref_r5, consts[SHIFTUP]
				sqv	vzero[0], 96(rec_in_dat)
	vmudn	ref_r6, ref_r6, consts[SHIFTUP]
				sqv	vzero[0], 112(rec_in_dat)
	vmudn	ref_r7, ref_r7, consts[SHIFTUP]

	bgtz	uvflag, sav_y
	nop

sav_uv:
	shv	ref_r0[0], 0(rec_out_dat)
	shv	ref_r1[0], 16(rec_out_dat)
	shv	ref_r2[0], 32(rec_out_dat)
	shv	ref_r3[0], 48(rec_out_dat)
	shv	ref_r4[0], 64(rec_out_dat)
	shv	ref_r5[0], 80(rec_out_dat)
	shv	ref_r6[0], 96(rec_out_dat)
	j	recon_next
	shv	ref_r7[0], 112(rec_out_dat)

		
sav_y:	
	suv	ref_r0[0], 0(rec_out_dat)
	suv	ref_r1[0], 16(rec_out_dat)
	suv	ref_r2[0], 32(rec_out_dat)
	suv	ref_r3[0], 48(rec_out_dat)
	suv	ref_r4[0], 64(rec_out_dat)
	suv	ref_r5[0], 80(rec_out_dat)
	suv	ref_r6[0], 96(rec_out_dat)
	suv	ref_r7[0], 112(rec_out_dat)


recon_next:
	lh	offset, RECON_OFF(loopcnt)
	add	rec_in_ref, rec_in_ref, offset
	addi	rec_in_dat, rec_in_dat, 128
	j	recon_loop		
	add	rec_out_dat, rec_out_dat, offset

	
recon_noref:	
	lqv	ref_r0[0], 0(rec_in_dat)
	lqv	ref_r1[0], 16(rec_in_dat)
	lqv	ref_r2[0], 32(rec_in_dat)
	lqv	ref_r3[0], 48(rec_in_dat)
	lqv	ref_r4[0], 64(rec_in_dat)
	lqv	ref_r5[0], 80(rec_in_dat)
	lqv	ref_r6[0], 96(rec_in_dat)
	j	shift_hi
	lqv	ref_r7[0], 112(rec_in_dat)

		
recon_ret:
	jr	return
	nop


#include "recon_un.h"