📄 mp4_recon.c
字号:
/********************************************************************************
* *
* This code has been developed by Project Mayo. This software is an *
* implementation of a part of one or more MPEG-4 Video tools as *
* specified in ISO/IEC 14496-2 standard. Those intending to use this *
* software module in hardware or software products are advised that its *
* use may infringe existing patents or copyrights, and any such use *
* would be at such party's own risk. The original developer of this *
* software module and his/her company, and subsequent editors and their *
* companies (including Project Mayo), will have no liability for use of *
* this software or modifications or derivatives thereof. *
* *
********************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* The GPL can be found at: http://www.gnu.org/copyleft/gpl.html *
* *
* Authors: *
* *
* Andrea Graziani (Ag): *
* - Original source code (Open Divx Decoder 0.4a). *
* *
* Pedro Mateu (Pm): *
* - Heavily modified and optimized code + MIPS ASM *
* *
* 'MindPower' *
* - ARM ASM routines. *
* *
********************************************************************************/
#include "global.h"
// this routine now in CopyBlock.obj (asm)
// Purpose: specialized basic motion compensation routines
#ifdef MIPS_ASM_64
static void CopyBlock(unsigned char * Src, unsigned char * Dst, int Stride)
{
__asm( "addi $2,$0,+8;"
"bucle :uld $10,0($4);"
"add $2,$2,-1;"
"add $4,$4,$6;"
"sdr $10,0($5);"
"add $5,$5,$6;"
"bgtz $2,bucle;");
}
static void CopyBlockHor(unsigned char * Src, unsigned char * Dst, int Stride)
{
__asm ( "addi $2,$0,+8;"
// 0x0101 0101 0101 0101
"li $24,0x01010101;"
"dsll $24,$24,32;"
"dsrl $10,$24,32;"
"or $24,$24,$10;"
// 0xFEFE FEFE FEFE FEFE
"nor $25,$24,$0;"
"bucle2 :uld $9,0($4);"
"uld $10,1($4);"
"or $14,$9,$10;"
"and $14,$14,$24;"
"add $4,$4,$6;"
"addi $2,$2,-1;"
"and $9,$9,$25;"
"and $10,$10,$25;"
"dsrl $9,$9,1;" //divide by 2
"dsrl $10,$10,1;"
"daddu $9,$9,$10;"
"daddu $10,$9,$14;"
"sdr $10,0($5);"
"add $5,$5,$6;"
"bgtz $2,bucle2;");
}
static void CopyBlockVer(unsigned char * Src, unsigned char * Dst, int Stride)
{
__asm ( "addi $2,$0,+8;"
// 0x0101 0101 0101 0101
"li $24,0x01010101;"
"dsll $24,$24,32;"
"dsrl $10,$24,32;"
"or $24,$24,$10;"
// 0xFEFE FEFE FEFE FEFE
"nor $25,$24,$0;"
//first point preprocessing
"uld $9,0($4);"
"move $13,$9;"
"and $9,$9,$25;"
"dsrl $9,$9,1;"
"bucle3 :add $4,$4,$6;"
"uld $10,0($4);"
"addi $2,$2,-1;"
"or $14,$13,$10;"
"and $14,$14,$24;"
// in order to divide by two
"and $10,$10,$25;"
//divide by two
"dsrl $10,$10,1;"
"daddu $9,$9,$10;"
"daddu $9,$9,$14;" //we add 1
"sdr $9,0($5);"
"move $9,$10;"
"add $5,$5,$6;"
"bgtz $2,bucle3;");
}
static void CopyBlockHorVer(unsigned char * Src, unsigned char * Dst, int Stride)
{
__asm ( "addi $2,$0,+8;"
// 0x0101 0101 0101 0101
"li $24,0x01010101;"
"dsll $24,$24,32;"
"dsrl $10,$24,32;"
"or $24,$24,$10;"
// 0xFEFE FEFE FEFE FEFE
"nor $25,$24,$0;"
//first line preprocessing
"uld $10,0($4);"
"uld $11,1($4);"
"or $14,$11,$10;"
"and $14,$14,$24;"
"and $10,$10,$25;"
"and $11,$11,$25;"
"dsrl $10,$10,1;"
"dsrl $11,$11,1;"
"daddu $10,$10,$11;"
"daddu $10,$10,$14;"
"move $15,$10;"
"and $10,$10,$25;"
"dsrl $10,$10,1;"
"bucle4 :addu $4,$4,$6;"
"uld $12,0($4);"
"uld $13,1($4);"
"or $14,$13,$12;"
"and $14,$14,$24;"
"and $12,$12,$25;"
"and $13,$13,$25;"
"dsrl $12,$12,1;"
"dsrl $13,$13,1;"
"daddu $12,$12,$13;"
"daddu $12,$12,$14;"
"or $14,$15,$12;"
"and $14,$14,$24;"
"and $12,$12,$25;"
"dsrl $12,$12,1;"
"daddu $10,$10,$12;"
"daddu $10,$10,$14;"//add 1
"sdr $10,0($5);"
"move $10,$12;"
"addi $2,$2,-1;"
"add $5,$5,$6;"
"bgtz $2,bucle4;");
}
static void CopyBlockHorRound(unsigned char * Src, unsigned char * Dst, int Stride)
{
__asm ( "addi $2,$0,+8;"
// 0x0101 0101 0101 0101
"li $24,0x01010101;"
"dsll $24,$24,32;"
"dsrl $10,$24,32;"
"or $24,$24,$10;"
// 0xFEFE FEFE FEFE FEFE
"nor $25,$24,$0;"
"bucle5 :uld $10,0($4);"
"uld $11,1($4);"
"and $14,$11,$10;"
"and $14,$14,$24;"
"addi $2,$2,-1;"
"add $4,$4,$6;"
"and $10,$10,$25;"
"and $11,$11,$25;"
"dsrl $10,$10,1;"
"dsrl $11,$11,1;"
"daddu $10,$10,$11;"
"daddu $10,$10,$14;"
"sdr $10,0($5);"
"add $5,$5,$6;"
"bgtz $2,bucle5;");
}
static void CopyBlockVerRound(unsigned char * Src, unsigned char * Dst, int Stride)
{
__asm ( "addi $2,$0,+8;"
// 0x0101 0101 0101 0101
"li $24,0x01010101;"
"dsll $24,$24,32;"
"dsrl $10,$24,32;"
"or $24,$24,$10;"
// 0xFEFE FEFE FEFE FEFE
"nor $25,$24,$0;"
"uld $10,0($4);"
"move $14,$10;"
"and $10,$10,$25;"
"dsrl $10,$10,1;"
"bucle6 :add $4,$4,$6;"
"uld $11,0($4);"
"and $14,$11,$10;"
"and $14,$14,$24;"
"add $3,$3,$6;"
"and $11,$11,$25;"
"dsrl $11,$11,1;"
"daddu $10,$10,$11;"
"daddu $10,$10,$14;"
"sdr $10,0($5);"
"move $10,$11;"
"addi $2,$2,-1;"
"add $5,$5,$6;"
"bgtz $2,bucle6;");
}
static void CopyBlockHorVerRound(unsigned char * Src, unsigned char * Dst, int Stride)
{
__asm ( "addi $2,$0,+8;"
// 0x0101 0101 0101 0101
"li $24,0x01010101;"
"dsll $24,$24,32;"
"dsrl $10,$24,32;"
"or $24,$24,$10;"
// 0xFEFE FEFE FEFE FEFE
"nor $25,$24,$0;"
//line preprocessing
"uld $10,0($4);"
"uld $11,1($4);"
"and $14,$10,$11;"
"and $14,$14,$24;"
"and $10,$10,$25;"
"and $11,$11,$25;"
"dsrl $10,$10,1;"
"dsrl $11,$11,1;"
"daddu $10,$10,$11;"
"daddu $10,$10,$14;"
"move $15,$10;"
"and $10,$10,$25;"
"dsrl $10,$10,1;"
"bucle7 :add $4,$4,$6;"
"uld $12,0($4);"
"uld $13,1($4);"
"and $14,$12,$13;"
"and $14,$14,$24;"
"and $12,$12,$25;"
"and $13,$13,$25;"
"dsrl $12,$12,1;"
"dsrl $13,$13,1;"
"daddu $12,$12,$13;"
"daddu $12,$12,$14;"
"and $14,$12,$15;"
"and $14,$14,$24;"
"and $12,$12,$25;"
"dsrl $12,$12,1;"
"daddu $10,$10,$12;"
"daddu $10,$10,$14;"
"sdr $10,0($5);"
"move $10,$12;"
"addi $2,$2,-1;"
"add $5,$5,$6;"
"bgtz $2,bucle7;");
}
static void CopyMBlock(unsigned char * Src, unsigned char * Dst, int Stride)
{
__asm( "addi $2,$0,+16;"
"bucle8 :uld $24,0($4);"
"uld $25,8($4);"
"add $2,$2,-1;"
"add $4,$4,$6;"
".set noreorder;"
"cache 13,0($5);"
".set reorder;"
"sdr $24,0($5);"
"sdr $25,8($5);"
"add $5,$5,$6;"
"bgtz $2,bucle8;");
}
static void CopyMBlockHor(unsigned char * Src, unsigned char * Dst, int Stride)
{
__asm( "addi $2,$0,+16;"
// 0x0101 0101 0101 0101
"li $24,0x01010101;"
"dsll $24,$24,32;"
"dsrl $10,$24,32;"
"or $24,$24,$10;"
// 0xFEFE FEFE FEFE FEFE
"nor $25,$24,$0;"
"bucle9 :uld $10,0($4);"
"uld $11,8($4);"
"uld $12,1($4);"
"uld $13,9($4);"
"or $14,$10,$12;"
"and $14,$14,$24;"
"or $15,$11,$13;"
"and $15,$15,$24;"
"addi $2,$2,-1;"
"add $4,$4,$6;"
"and $10,$10,$25;"
"and $11,$11,$25;"
"and $12,$12,$25;"
"and $13,$13,$25;"
"dsrl $10,$10,1;"
"dsrl $11,$11,1;"
"dsrl $12,$12,1;"
"dsrl $13,$13,1;"
".set noreorder;"
"cache 13,0($5);"
".set reorder;"
"daddu $10,$10,$12;"
"daddu $11,$11,$13;"
"daddu $10,$10,$14;" //we add 1
"sdr $10,0($5);"
"daddu $10,$11,$15;"
"sdr $10,8($5);"
"add $5,$5,$6;"
"bgtz $2,bucle9;");
}
static void CopyMBlockVer(unsigned char * Src, unsigned char * Dst, int Stride)
{
__asm( "addi $2,$0,+16;"
// 0x0101 0101 0101 0101
"li $24,0x01010101;"
"dsll $24,$24,32;"
"dsrl $10,$24,32;"
"or $24,$24,$10;"
// 0xFEFE FEFE FEFE FEFE
"nor $25,$24,$0;"
//line preprocessing
"uld $10,0($4);"
"uld $11,8($4);"
"move $7,$10;"
"move $3,$11;"
"or $15,$11,$13;"
"and $15,$15,$24;"
"and $10,$10,$25;"
"and $11,$11,$25;"
"dsrl $10,$10,1;"
"dsrl $11,$11,1;"
"bucle10:add $4,$4,$6;"
"uld $12,0($4);"
"uld $13,8($4);"
"or $14,$7,$12;"
"and $14,$14,$24;"
"or $15,$3,$13;"
"and $15,$15,$24;"
"addi $2,$2,-1;"
"and $12,$12,$25;"
"and $13,$13,$25;"
".set noreorder;"
"cache 13,0($5);"
".set reorder;"
"dsrl $12,$12,1;"
"dsrl $13,$13,1;"
"daddu $10,$10,$12;"
"daddu $10,$10,$14;" //we add 1
"sdr $10,0($5);"
"move $10,$12;"
"daddu $11,$11,$13;"
"daddu $11,$11,$15;"
"sdr $11,8($5);"
"move $11,$13;"
"add $5,$5,$6;"
"bgtz $2,bucle10;");
}
static void CopyMBlockHorRound(unsigned char * Src, unsigned char * Dst, int Stride)
{
__asm( "addi $2,$0,+16;"
// 0x0101 0101 0101 0101
"li $24,0x01010101;"
"dsll $24,$24,32;"
"dsrl $10,$24,32;"
"or $24,$24,$10;"
// 0xFEFE FEFE FEFE FEFE
"nor $25,$24,$0;"
"bucle12:uld $10,0($4);"
"uld $11,8($4);"
"uld $12,1($4);"
"uld $13,9($4);"
"and $14,$10,$12;"
"and $14,$14,$24;"
"and $15,$11,$13;"
"and $15,$15,$24;"
"addi $2,$2,-1;"
"add $4,$4,$6;"
"and $10,$10,$25;"
"and $11,$11,$25;"
"and $12,$12,$25;"
"and $13,$13,$25;"
".set noreorder;"
"cache 13,0($5);"
".set reorder;"
"dsrl $10,$10,1;"
"dsrl $11,$11,1;"
"dsrl $12,$12,1;"
"dsrl $13,$13,1;"
"daddu $10,$10,$12;"
"daddu $10,$10,$14;"
"sdr $10,0($5);"
"daddu $10,$11,$13;"
"daddu $10,$10,$15;"
"sdr $10,8($5);"
"add $5,$5,$6;"
"bgtz $2,bucle12;");
}
static void CopyMBlockVerRound(unsigned char * Src, unsigned char * Dst, int Stride)
{
__asm( "addi $2,$0,+16;"
// 0x0101 0101 0101 0101
"li $24,0x01010101;"
"dsll $24,$24,32;"
"dsrl $10,$24,32;"
"or $24,$24,$10;"
// 0xFEFE FEFE FEFE FEFE
"nor $25,$24,$0;"
"uld $10,0($4);"
"uld $11,8($4);"
"move $7,$10;"
"move $3,$14;"
"and $10,$10,$25;"
"and $11,$11,$25;"
"dsrl $10,$10,1;"
"dsrl $11,$11,1;"
"bucle13:add $4,$4,$6;"
"uld $12,0($4);"
"uld $13,8($4);"
"and $14,$7,$12;"
"and $14,$14,$24;"
"and $15,$3,$13;"
"and $15,$15,$24;"
"addi $2,$2,-1;"
"and $12,$12,$25;"
"and $13,$13,$25;"
".set noreorder;"
"cache 13,0($5);"
".set reorder;"
"dsrl $12,$12,1;"
"dsrl $13,$13,1;"
"daddu $10,$10,$12;"
"daddu $10,$10,$14;"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -