📄 fyuvrgb.old
字号:
shr ax,3 ;//G[5]
shld ax,dx,5 ;//B[5]
mov es:[edi+640+4],ax ;//Write AX=RGB16[5:6:5]
///////// R G B ////// //////
mov ah,bh //////
add ah,ch ;//AH=R=Y+Cr //////
shr ah,3 ;//R[5]
mov al,bh //////
sub al,DL ;//AL=G=Y-Cg //////
add bh,cl ;//DH=B=Y+Cb //////
//////////////////////////////////////////////////////
shr ax,3 ;//G[5]
shld ax,bx,5 ;//B[5]
mov es:[edi+640+4+2],ax ;//Write AX=RGB16[5:6:5]
add edi,8 ;//Y source 4 byte
add esi,4 ;//Y source 4 byte
add ebp,2 ;//UV source 2 byts
}
// EDI had add when write pixel
}
void FastYUV2RGB15BitsDeletePixel(void)
{ //EAX,EBX,ECX,EDX,EDI,ESI,EBP changed
//GS->Video data selector
//ES->Video Buffer
//Must compile with Fastest code optimization,the EBP will not save
asm{
mov bx,gs:[ebp] ;//U1U2
mov cx,gs:[ebp+0x240] ;//V1V2
xchg cl,bh
//CH=U2 CL=V2 BH=U1 BL=V1(Store in BX)
////////////Use DX to compute U2V2////////////////////
////Compute U & V ///////// //////
sub cl,128 ;//Cb=V-=128 //////
sub ch,128 ;//Cr=U-=128 //////
////////Compute U/2+V/5 ////////// //////
mov dl,ch //////
sar dl,1 ;//Cr/2 //////
////////////// CH=Cr DL=Cg CL=Cb /////////////////////
mov Cg,dx //Store in high 16 bits
mov CrCb,cx
//////////////////////////////////////////////////////
mov cx,bx
////////////Use DX to compute U1V1////////////////////
////Compute U & V ///////// //////
sub cl,128 ;//Cb=V-=128 //////
sub ch,128 ;//Cr=U-=128 //////
////////Compute U/2+V/5 ////////// //////
mov dl,ch //////
sar dl,1 ;//Cr/2 //////
////////////// CH=Cr DL=Cg CL=Cb /////////////////////
//////////////////////////////////////////////////////
mov bx,gs:[esi] //Line 1 Y1 Y2
//////////////////////////////////////////////////////
SUB BH,128
SAR BH,1
ADD BH,128 //Protect not over
SUB BL,128
SAR BL,1
ADD BL,128
///////// R G B ////// //////
mov ah,bl //////
add ah,ch ;//AH=R=Y+Cr //////
shr ah,3 ;//R[5]
mov al,bl
sub al,DL ;//AL=G=Y-Cg //////
mov dh,bl //////
add dh,cl ;//DH=B=Y+Cb //////
//////////////////////////////////////////////////////
shr ax,3 ;//G[5]
shld ax,dx,5 ;//B[5]
mov es:[edi],ax ;//Write AX=RGB16[5:6:5]
///////// R G B ////// //////
mov ah,bh //////
add ah,ch ;//AH=R=Y+Cr //////
shr ah,3 ;//R[5]
mov al,bh //////
sub al,DL ;//AL=G=Y-Cg //////
add bh,cl ;//DH=B=Y+Cb //////
//////////////////////////////////////////////////////
shr ax,3 ;//G[5]
shld ax,bx,5 ;//B[5]
mov es:[edi+2],ax ;//Write AX=RGB16[5:6:5]
//////////////////////////////////////////////////////
mov bx,gs:[esi+0x480]//Line 2 Y1 Y2
//////////////////////////////////////////////////////
SUB BH,128
SAR BH,1
ADD BH,128 //Protect not over
SUB BL,128
SAR BL,1
ADD BL,128
///////// R G B ////// //////
mov ah,bl //////
add ah,ch ;//AH=R=Y+Cr //////
shr ah,3 ;//R[5]
mov al,bl
sub al,DL ;//AL=G=Y-Cg //////
mov dh,bl //////
add dh,cl ;//DH=B=Y+Cb //////
//////////////////////////////////////////////////////
shr ax,3 ;//G[5]
shld ax,dx,5 ;//B[5]
mov es:[edi+640],ax ;//Write AX=RGB16[5:6:5]
///////// R G B ////// //////
mov ah,bh //////
add ah,ch ;//AH=R=Y+Cr //////
shr ah,3 ;//R[5]
mov al,bh //////
sub al,DL ;//AL=G=Y-Cg //////
add bh,cl ;//DH=B=Y+Cb //////
//////////////////////////////////////////////////////
shr ax,3 ;//G[5]
shld ax,bx,5 ;//B[5]
mov es:[edi+640+2],ax ;//Write AX=RGB16[5:6:5]
/////////////////////////////////////////////////////
///U2 V2\\\
//////////////////////////////////////////////////////
mov cx,CrCb
mov dx,Cg
//////////////////////////////////////////////////////
mov bh,gs:[esi+2] //Line 1 Y3 Y4
//////////////////////////////////////////////////////
SUB BH,128
SAR BH,1
ADD BH,128 //Protect not over
SUB BL,128
SAR BL,1
ADD BL,128
///////// R G B ////// //////
mov ah,bh //////
add ah,ch ;//AH=R=Y+Cr //////
shr ah,3 ;//R[5]
mov al,bh //////
sub al,DL ;//AL=G=Y-Cg //////
add bh,cl ;//DH=B=Y+Cb //////
//////////////////////////////////////////////////////
shr ax,3 ;//G[5]
shld ax,bx,5 ;//B[5]
mov es:[edi+4],ax ;//Write 1 AX=RGB16[5:6:5]
//////////////////////////////////////////////////////
mov bh,gs:[esi+0x480+2]//Line 2 Y1 Y2
//////////////////////////////////////////////////////
SUB BH,128
SAR BH,1
ADD BH,128 //Protect not over
SUB BL,128
SAR BL,1
ADD BL,128
///////// R G B ////// //////
mov ah,bh //////
add ah,ch ;//AH=R=Y+Cr //////
shr ah,3 ;//R[5]
mov al,bh //////
sub al,DL ;//AL=G=Y-Cg //////
add bh,cl ;//DH=B=Y+Cb //////
//////////////////////////////////////////////////////
shr ax,3 ;//G[5]
shld ax,bx,5 ;//B[5]
mov es:[edi+640+4],ax ;//Write AX=RGB16[5:6:5]
add edi,6 ;//Y source 4 byte
add esi,4 ;//Y source 4 byte
add ebp,2 ;//UV source 2 byts
}
// EDI had add when write pixel
}
//////////// One line only ///////////
void FastYUV2RGB15Bits1Line(void)
{ //EAX,EBX,ECX,EDX,EDI,ESI,EBP changed
//GS->Video data selector
//ES->Video Buffer
//Must compile with Fastest code optimization,the EBP will not save
asm{
mov bx,gs:[ebp] ;//U1U2
mov cx,gs:[ebp+0x240] ;//V1V2
xchg cl,bh
//CH=U2 CL=V2 BH=U1 BL=V1(Store in BX)
////////////Use DX to compute U2V2////////////////////
////Compute U & V ///////// //////
sub cl,128 ;//Cb=V-=128 //////
sub ch,128 ;//Cr=U-=128 //////
////////Compute U/2+V/5 ////////// //////
mov dl,ch //////
sar dl,1 ;//Cr/2 //////
////////////// CH=Cr DL=Cg CL=Cb /////////////////////
mov Cg,dx //Store in high 16 bits
mov CrCb,cx
//////////////////////////////////////////////////////
mov cx,bx
////////////Use DX to compute U1V1////////////////////
////Compute U & V ///////// //////
sub cl,128 ;//Cb=V-=128 //////
sub ch,128 ;//Cr=U-=128 //////
////////Compute U/2+V/5 ////////// //////
mov dl,ch //////
sar dl,1 ;//Cr/2 //////
////////////// CH=Cr DL=Cg CL=Cb /////////////////////
//////////////////////////////////////////////////////
mov bx,gs:[esi] //Line 1 Y1 Y2
//////////////////////////////////////////////////////
SUB BH,128
SAR BH,1
ADD BH,128 //Protect not over
SUB BL,128
SAR BL,1
ADD BL,128
///////// R G B ////// //////
mov ah,bl //////
add ah,ch ;//AH=R=Y+Cr //////
shr ah,3 ;//R[5]
mov al,bl
sub al,DL ;//AL=G=Y-Cg //////
mov dh,bl //////
add dh,cl ;//DH=B=Y+Cb //////
//////////////////////////////////////////////////////
shr ax,3 ;//G[5]
shld ax,dx,5 ;//B[5]
mov es:[edi],ax ;//Write AX=RGB16[5:6:5]
///////// R G B ////// //////
mov ah,bh //////
add ah,ch ;//AH=R=Y+Cr //////
shr ah,3 ;//R[5]
mov al,bh //////
sub al,DL ;//AL=G=Y-Cg //////
add bh,cl ;//DH=B=Y+Cb //////
//////////////////////////////////////////////////////
shr ax,3 ;//G[5]
shld ax,bx,5 ;//B[5]
mov es:[edi+2],ax ;//Write AX=RGB16[5:6:5]
/////////////////////////////////////////////////////
///U2 V2\\\
//////////////////////////////////////////////////////
mov cx,CrCb
mov dx,Cg
//////////////////////////////////////////////////////
mov bx,gs:[esi+2] //Line 1 Y3 Y4
//////////////////////////////////////////////////////
SUB BH,128
SAR BH,1
ADD BH,128 //Protect not over
SUB BL,128
SAR BL,1
ADD BL,128
///////// R G B ////// //////
mov ah,bl //////
add ah,ch ;//AH=R=Y+Cr //////
shr ah,3 ;//R[5]
mov al,bl
sub al,DL ;//AL=G=Y-Cg //////
mov dh,bl //////
add dh,cl ;//DH=B=Y+Cb //////
//////////////////////////////////////////////////////
shr ax,3 ;//G[5]
shld ax,dx,5 ;//B[5]
mov es:[edi+4],ax ;//Write AX=RGB16[5:6:5]
///////// R G B ////// //////
mov ah,bh //////
add ah,ch ;//AH=R=Y+Cr //////
shr ah,3 ;//R[5]
mov al,bh //////
sub al,DL ;//AL=G=Y-Cg //////
add bh,cl ;//DH=B=Y+Cb //////
//////////////////////////////////////////////////////
shr ax,3 ;//G[5]
shld ax,bx,5 ;//B[5]
mov es:[edi+4+2],ax ;//Write AX=RGB16[5:6:5]
//////////////////////////////////////////////////////
add edi,8 ;//Y source 4 byte
add esi,4 ;//Y source 4 byte
add ebp,2 ;//UV source 2 byts
}
// EDI had add when write pixel
}
void FastYUV2RGB15Bits1LineDeletePixel(void)
{ //EAX,EBX,ECX,EDX,EDI,ESI,EBP changed
//GS->Video data selector
//ES->Video Buffer
//Must compile with Fastest code optimization,the EBP will not save
asm{
mov bx,gs:[ebp] ;//U1U2
mov cx,gs:[ebp+0x240] ;//V1V2
xchg cl,bh
//CH=U2 CL=V2 BH=U1 BL=V1(Store in BX)
////////////Use DX to compute U2V2////////////////////
////Compute U & V ///////// //////
sub cl,128 ;//Cb=V-=128 //////
sub ch,128 ;//Cr=U-=128 //////
////////Compute U/2+V/5 ////////// //////
mov dl,ch //////
sar dl,1 ;//Cr/2 //////
////////////// CH=Cr DL=Cg CL=Cb /////////////////////
mov Cg,dx //Store in high 16 bits
mov CrCb,cx
//////////////////////////////////////////////////////
mov cx,bx
////////////Use DX to compute U1V1////////////////////
////Compute U & V ///////// //////
sub cl,128 ;//Cb=V-=128 //////
sub ch,128 ;//Cr=U-=128 //////
////////Compute U/2+V/5 ////////// //////
mov dl,ch //////
sar dl,1 ;//Cr/2 //////
////////////// CH=Cr DL=Cg CL=Cb /////////////////////
//////////////////////////////////////////////////////
mov bx,gs:[esi] //Line 1 Y1 Y2
//////////////////////////////////////////////////////
SUB BH,128
SAR BH,1
ADD BH,128 //Protect not over
SUB BL,128
SAR BL,1
ADD BL,128
///////// R G B ////// //////
mov ah,bl //////
add ah,ch ;//AH=R=Y+Cr //////
shr ah,3 ;//R[5]
mov al,bl
sub al,DL ;//AL=G=Y-Cg //////
mov dh,bl //////
add dh,cl ;//DH=B=Y+Cb //////
//////////////////////////////////////////////////////
shr ax,3 ;//G[5]
shld ax,dx,5 ;//B[5]
mov es:[edi],ax ;//Write AX=RGB16[5:6:5]
///////// R G B ////// //////
mov ah,bh //////
add ah,ch ;//AH=R=Y+Cr //////
shr ah,3 ;//R[5]
mov al,bh //////
sub al,DL ;//AL=G=Y-Cg //////
add bh,cl ;//DH=B=Y+Cb //////
//////////////////////////////////////////////////////
shr ax,3 ;//G[5]
shld ax,bx,5 ;//B[5]
mov es:[edi+2],ax ;//Write AX=RGB16[5:6:5]
//////////////////////////////////////////////////////
///U2 V2\\\
//////////////////////////////////////////////////////
mov cx,CrCb
mov dx,Cg
//////////////////////////////////////////////////////
mov bh,gs:[esi+2] //Line 1 Y3 Y4
//////////////////////////////////////////////////////
SUB BH,128
SAR BH,1
ADD BH,128 //Protect not over
SUB BL,128
SAR BL,1
ADD BL,128
///////// R G B ////// //////
mov ah,bh //////
add ah,ch ;//AH=R=Y+Cr //////
shr ah,3 ;//R[5]
mov al,bh //////
sub al,DL ;//AL=G=Y-Cg //////
add bh,cl ;//DH=B=Y+Cb //////
//////////////////////////////////////////////////////
shr ax,3 ;//G[5]
shld ax,bx,5 ;//B[5]
mov es:[edi+4],ax ;//Write 1 AX=RGB16[5:6:5]
//////////////////////////////////////////////////////
add edi,6 ;//Y source 4 byte
add esi,4 ;//Y source 4 byte
add ebp,2 ;//UV source 2 byts
}
// EDI had add when write pixel
}
void FastYUV2RGB15BitsDouble(void)
{ //EAX,EBX,ECX,EDX,EDI,ESI,EBP changed
//GS->Video data selector
//ES->Video Buffer
//Must compile with Fastest code optimization,the EBP will not save
asm{
mov bx,gs:[ebp] ;//U1U2
mov cx,gs:[ebp+0x240] ;//V1V2
xchg cl,bh
//CH=U2 CL=V2 BH=U1 BL=V1(Store in BX)
////////////Use DX to compute U2V2////////////////////
////Compute U & V ///////// //////
sub cl,128 ;//Cb=V-=128 //////
sub ch,128 ;//Cr=U-=128 //////
////////Compute U/2+V/5 ////////// //////
mov dl,ch //////
sar dl,1 ;//Cr/2 //////
////////////// CH=Cr DL=Cg CL=Cb /////////////////////
mov Cg,dx //Store in high 16 bits
mov CrCb,cx
//////////////////////////////////////////////////////
mov cx,bx
////////////Use DX to compute U1V1////////////////////
////Compute U & V ///////// //////
sub cl,128 ;//Cb=V-=128 //////
sub ch,128 ;//Cr=U-=128 //////
////////Compute U/2+V/5 ////////// //////
mov dl,ch //////
sar dl,1 ;//Cr/2 //////
////////////// CH=Cr DL=Cg CL=Cb /////////////////////
//////////////////////////////////////////////////////
mov bx,gs:[esi] //Line 1 Y1 Y2
//////////////////////////////////////////////////////
SUB BH,128
SAR BH,1
ADD BH,128 //Protect not over
SUB BL,128
SAR BL,1
ADD BL,128
///////// R G B ////// //////
mov ah,bl //////
add ah,ch ;//AH=R=Y+Cr //////
shr ah,3 ;//R[5]
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -