recon.s 3.47 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

Outputs:	

	data at rec_out_dat	- reconstructed data
*/


recon:
	nop
	nop

recon_init:
	andi	flag, mbtype, MBT_INTRA
	addi	uvflag, rzero, 0
	
	addi	caddr, rzero, RECON_CONSTS
	lqv	consts, 0(caddr)

	addi	loopcnt, rzero, FOUR
	

recon_loop:
	bgtz	loopcnt, recon_y
	addi	loopcnt, loopcnt, NEG1

	addi	rec_in_ref, rec_in_ref, CR_OFFSET
	addi	rec_out_dat, rec_out_dat, CR_OFFSET
		
recon_uv:
	bgtz	flag, sav_intra
	nop
	
	lhv	ref_r0,	0(rec_in_ref)
	lhv	ref_r1,	16(rec_in_ref)
	lhv	ref_r2, 32(rec_in_ref)
	lhv	ref_r3, 48(rec_in_ref)
	lhv	ref_r4, 64(rec_in_ref)
	lhv	ref_r5, 80(rec_in_ref)
	lhv	ref_r6, 96(rec_in_ref)
	lhv	ref_r7, 112(rec_in_ref)
	j	shift_lo	
	nop
	
recon_y:
	bgtz	flag, sav_intra
	nop
	
	luv	ref_r0,	0(rec_in_ref)
	luv	ref_r1,	16(rec_in_ref)
	luv	ref_r2, 32(rec_in_ref)
	luv	ref_r3, 48(rec_in_ref)
	luv	ref_r4, 64(rec_in_ref)
	luv	ref_r5, 80(rec_in_ref)
	luv	ref_r6, 96(rec_in_ref)
	luv	ref_r7, 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]	
	vmudm	ref_r4, ref_r4, consts[SHIFTDN]	
	vmudm	ref_r5, ref_r5, consts[SHIFTDN]	
	vmudm	ref_r6, ref_r6, consts[SHIFTDN]
	vmudm	ref_r7, ref_r7, consts[SHIFTDN]
	
	andi	dummy, rec_in_cbp, 1
	blez	dummy, recon_noadd
	srl	rec_in_cbp, rec_in_cbp, 1

recon_add:
	lqv	err_r0, 0(rec_in_dat)
	lqv	err_r1, 16(rec_in_dat)
	lqv	err_r2, 32(rec_in_dat)
	lqv	err_r3, 48(rec_in_dat)
	lqv	err_r4, 64(rec_in_dat)
	lqv	err_r5, 80(rec_in_dat)
	lqv	err_r6, 96(rec_in_dat)
	lqv	err_r7, 112(rec_in_dat)

	vadd	ref_r0, ref_r0, err_r0
	vadd	ref_r1, ref_r1, err_r1
	vadd	ref_r2, ref_r2, err_r2
	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
	
	j	recon_noadd
	nop
	
sav_intra:
	lqv	ref_r0, 0(rec_in_dat)	
	lqv	ref_r1, 16(rec_in_dat)
	lqv	ref_r2, 32(rec_in_dat)
	lqv	ref_r3, 48(rec_in_dat)
	lqv	ref_r4, 64(rec_in_dat)
	lqv	ref_r5, 80(rec_in_dat)
	lqv	ref_r6, 96(rec_in_dat)
	lqv	ref_r7, 112(rec_in_dat)
		
recon_noadd:
	vmudn	ref_r0, ref_r0, consts[SHIFTUP]
	vmudn	ref_r1, ref_r1, consts[SHIFTUP]
	vmudn	ref_r2, ref_r2, consts[SHIFTUP]
	vmudn	ref_r3, ref_r3, consts[SHIFTUP]
	vmudn	ref_r4, ref_r4, consts[SHIFTUP]
	vmudn	ref_r5, ref_r5, consts[SHIFTUP]
	vmudn	ref_r6, ref_r6, consts[SHIFTUP]
	vmudn	ref_r7, ref_r7, consts[SHIFTUP]

	bgez	loopcnt, sav_y
	nop
	
sav_uv:	
	shv	ref_r0, 0(rec_out_dat)
	shv	ref_r1, 16(rec_out_dat)
	shv	ref_r2, 32(rec_out_dat)
	shv	ref_r3, 48(rec_out_dat)
	shv	ref_r4, 64(rec_out_dat)
	shv	ref_r5, 80(rec_out_dat)
	shv	ref_r6, 96(rec_out_dat)
	shv	ref_r7, 112(rec_out_dat)	
	j	recon_next
	nop	
			
sav_y:	
	suv	ref_r0, 0(rec_out_dat)
	suv	ref_r1, 16(rec_out_dat)
	suv	ref_r2, 32(rec_out_dat)
	suv	ref_r3, 48(rec_out_dat)
	suv	ref_r4, 64(rec_out_dat)
	suv	ref_r5, 80(rec_out_dat)
	suv	ref_r6, 96(rec_out_dat)
	suv	ref_r7, 112(rec_out_dat)


recon_next:
	bltz	loopcnt, recon_final
	nop
		
	andi	dummy, loopcnt, 1
	lb	offset, RECON_OFF(dummy)
	add	rec_in_ref, rec_in_ref, offset
	addi	rec_in_dat, rec_in_dat, 128
	add	rec_out_dat, rec_out_dat, offset

	j	recon_loop		
	nop

recon_final:
	bgtz	uvflag, recon_ret
	addi	uvflag, rzero, 1

	addi	rec_in_ref, rec_in_ref, 1
	addi	rec_in_dat, rec_in_dat, 128
	addi	rec_out_dat, rec_out_dat, 1
	
	j	recon_uv
	nop

recon_ret:
	jr	return
	nop


	
#include "recon_un.h"