21 |
; * along with this program ; if not, write to the Free Software |
; * along with this program ; if not, write to the Free Software |
22 |
; * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
; * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
23 |
; * |
; * |
24 |
; * $Id: quantize_mpeg_mmx.asm,v 1.7 2006-07-11 10:01:27 chl Exp $ |
; * $Id: quantize_mpeg_mmx.asm,v 1.8 2006-09-22 03:40:11 syskin Exp $ |
25 |
; * |
; * |
26 |
; *************************************************************************/ |
; *************************************************************************/ |
27 |
|
|
221 |
; calculate DC |
; calculate DC |
222 |
movsx eax, word [eax] ; data[0] |
movsx eax, word [eax] ; data[0] |
223 |
mov ecx, [esp + 4 + 16] ; dcscalar |
mov ecx, [esp + 4 + 16] ; dcscalar |
224 |
mov edx, ecx |
mov edx, eax |
225 |
shr edx, 1 ; edx = dcscalar /2 |
mov edi, ecx |
226 |
mov edi, edx |
shr ecx, 1 ; ecx = dcscalar/2 |
227 |
neg edi |
sar edx, 31 ; edx = sign extend of eax (ready for division too) |
228 |
|
xor ecx, edx ; adjust ecx according to the sign of data[0] |
229 |
cmp eax, 0 |
sub ecx, edx |
230 |
cmovg edx, edi |
add eax, ecx |
231 |
sub eax, edx |
|
232 |
|
mov ecx, [esp + 4 + 4] ; coeff again |
233 |
mov edi, [esp + 4 + 4] ; coeff again |
idiv edi ; eax = edx:eax / dcscalar |
234 |
|
mov [ecx], ax ; coeff[0] = ax |
|
cdq ; expand eax -> edx:eax |
|
|
idiv ecx ; eax = edx:eax / dcscalar |
|
|
|
|
|
mov [edi], ax ; coeff[0] = ax |
|
235 |
|
|
236 |
pop edi |
pop edi |
237 |
|
|