y2touy.asm
Upload User: dangjiwu
Upload Date: 2013-07-19
Package Size: 42019k
Code Size: 7k
Category:

Symbian

Development Platform:

Visual C++

  1. ;
  2. ; ***** BEGIN LICENSE BLOCK *****
  3. ; Source last modified: $Id: y2touy.asm,v 1.1.1.1.50.1 2004/07/09 02:00:18 hubbe Exp $
  4. ; Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved.
  5. ; The contents of this file, and the files included with this file,
  6. ; are subject to the current version of the RealNetworks Public
  7. ; Source License (the "RPSL") available at
  8. ; http://www.helixcommunity.org/content/rpsl unless you have licensed
  9. ; the file under the current version of the RealNetworks Community
  10. ; Source License (the "RCSL") available at
  11. ; http://www.helixcommunity.org/content/rcsl, in which case the RCSL
  12. ; will apply. You may also obtain the license terms directly from
  13. ; RealNetworks.  You may not use this file except in compliance with
  14. ; the RPSL or, if you have a valid RCSL with RealNetworks applicable
  15. ; to this file, the RCSL.  Please see the applicable RPSL or RCSL for
  16. ; the rights, obligations and limitations governing use of the
  17. ; contents of the file.
  18. ; Alternatively, the contents of this file may be used under the
  19. ; terms of the GNU General Public License Version 2 or later (the
  20. ; "GPL") in which case the provisions of the GPL are applicable
  21. ; instead of those above. If you wish to allow use of your version of
  22. ; this file only under the terms of the GPL, and not to allow others
  23. ; to use your version of this file under the terms of either the RPSL
  24. ; or RCSL, indicate your decision by deleting the provisions above
  25. ; and replace them with the notice and other provisions required by
  26. ; the GPL. If you do not delete the provisions above, a recipient may
  27. ; use your version of this file under the terms of any one of the
  28. ; RPSL, the RCSL or the GPL.
  29. ; This file is part of the Helix DNA Technology. RealNetworks is the
  30. ; developer of the Original Code and owns the copyrights in the
  31. ; portions it created.
  32. ; This file, and the files included with this file, is distributed
  33. ; and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY
  34. ; KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS
  35. ; ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES
  36. ; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET
  37. ; ENJOYMENT OR NON-INFRINGEMENT.
  38. ; Technology Compatibility Kit Test Suite(s) Location:
  39. ;    http://www.helixcommunity.org/content/tck
  40. ; Contributor(s):
  41. ; ***** END LICENSE BLOCK *****
  42. ;
  43. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  44. ;;
  45. ;;  YUY2 to UYVY MMX converter.
  46. ;;
  47. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  48. %ifdef   COFF
  49.         %define YUY2ToUYVY_MMX _YUY2ToUYVY_MMX
  50. %elifdef WIN32
  51.         %define YUY2ToUYVY_MMX _YUY2ToUYVY_MMX
  52. %elifdef ELF
  53.         %define YUY2ToUYVY_MMX YUY2ToUYVY_MMX
  54. %elifdef AOUTB
  55.         %define YUY2ToUYVY_MMX YUY2ToUYVY_MMX
  56. %else
  57.         %error linking format currently not supported by alphbablend.asm
  58. %endif
  59.         ;; Export the functions implemented here.
  60.         global YUY2ToUYVY_MMX
  61. ;========================= DATA SEGMENT ============================
  62. section .data
  63. align 8        
  64. ;============================= CODE SEGMENT =======================                        
  65. section .text
  66. ;;
  67. ;; This is our stack params definition. It is used for both
  68. ;; YUY2 and UYVY routines as they both take the same parms.
  69. ;;                                        
  70. %assign numtemps 4
  71. %define var(a) [esp+a]       
  72.                 
  73. struc parms
  74.         ;Temps on stack
  75.         .tmp1       resd 1  ;General DWORD temp.
  76.         .tmp2       resd 1  ;General DWORD temp.
  77.         .tmp3       resd 1  ;General DWORD temp.
  78.         .tmp4       resd 1  ;General DWORD temp.
  79.         
  80.         ; Space for reg pushes and return address.
  81.         .registers  resd 6  ;pushed registers
  82.         .return     resd 1  ;return address
  83.         ; input params
  84.         .src:       resd 1  ;unsigned char*,      
  85.         .dest:      resd 1  ;unsigned char*,      
  86.         .dx:        resd 1  ;ULONG32,      
  87. endstruc
  88. YUY2ToUYVY_MMX:
  89.         ;; Save some stuff...
  90.         push ebx
  91.         push edi
  92.         push esi
  93.         push ebp
  94.         push ecx
  95.         push edx
  96.         ; Make room for temps on stack
  97.         sub esp, numtemps*4;
  98.         ;; Grab source and dest pointers...
  99.         mov esi, var(parms.src)
  100.         mov edi, var(parms.dest)
  101.         ;; Preload our address add constant
  102.         mov edx, 8
  103.      
  104.         mov ecx, var(parms.dx)
  105.         shr ecx, 3              ; we do 4 macro pixels at a time.
  106.         jnc loop1               ; Do we have a width that is a multiple of 8?
  107.         ;; We have 2 macro pixels left over. Do them here
  108.         
  109.         movq  mm0, [esi]        ; grab 2 macro pixels from source
  110.         movq  mm1, mm0          ; mm1=mm0= VVYYUUYY VVYYUUYY 
  111.         psllw mm1, 8            ; mm1 = YY00YY00 YY00YY00
  112.         psrlw mm0, 8            ; mm0 = 00VV00UU 00VV00UU
  113.         por   mm0, mm1          ; mm0 = YYVVYYUU YYVVYYUU
  114.         movq  [edi], mm0        ; store it.
  115.         add   esi, edx
  116.         add   edi, edx
  117.         ;; This loops does 16 bytes at a time (4 macro pixels).
  118. loop1:   
  119.         movq  mm0, [esi]        ; grab 2 macro pixels from source
  120.         add esi, edx
  121.         movq  mm1, mm0          ; mm1=mm0= VVYYUUYY VVYYUUYY 
  122.         psllw mm1, 8            ; mm1 = YY00YY00 YY00YY00
  123.         psrlw mm0, 8            ; mm0 = 00VV00UU 00VV00UU
  124.         movq  mm2, [esi]        ; grab 2 macro pixels from source
  125.         por   mm0, mm1          ; mm0 = YYVVYYUU YYVVYYUU
  126.         movq  mm3, mm2          ; mm1=mm0= VVYYUUYY VVYYUUYY 
  127.         
  128.         movq  [edi], mm0        ; store it.
  129.         add edi, edx
  130.         psllw mm3, 8            ; mm1 = YY00YY00 YY00YY00
  131.         psrlw mm2, 8            ; mm0 = 00VV00UU 00VV00UU
  132.         por   mm2, mm3          ; mm0 = YYVVYYUU YYVVYYUU
  133.         add esi, edx
  134.         
  135.         movq  [edi], mm2        ; store it.
  136.                 
  137.         ;; Now do the loop calcs....
  138.         add edi, edx
  139.         dec ecx
  140.         jnz loop1
  141.         
  142. end: 
  143.         ;; Free up stack temp var.
  144.         add esp, numtemps*4
  145.         
  146.         ;; Pop off the stack....
  147.         pop edx
  148.         pop ecx
  149.         pop ebp
  150.         pop esi
  151.         pop edi
  152.         pop ebx
  153.         ;; This emms is expensive. If we don't do it we wipe out the
  154.         ;; floating ponts registers but that should be ok.
  155. ;         emms 
  156.         
  157.         ;; success
  158.         xor eax, eax
  159.         ret
  160. ;;; leave a trace
  161. version: db '$(gfw) Copyright 2001 RealNetworks Inc. Revision:1.0 $',0