src/render/SDL_yuv_sw_c.h
author Ryan C. Gordon <icculus@icculus.org>
Fri, 01 May 2015 01:12:48 -0400
changeset 9580 d37ef6990bf9
parent 8149 681eb46b8ac4
child 9619 b94b6d0bff0f
permissions -rw-r--r--
checkkeys: Readded the KEYUP event test.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
     1
/*
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
     2
  Simple DirectMedia Layer
8149
681eb46b8ac4 Fixed bug 2374 - Update copyright for 2014...
Sam Lantinga <slouken@libsdl.org>
parents: 8093
diff changeset
     3
  Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
     4
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
     5
  This software is provided 'as-is', without any express or implied
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
     6
  warranty.  In no event will the authors be held liable for any damages
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
     7
  arising from the use of this software.
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
     8
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
     9
  Permission is granted to anyone to use this software for any purpose,
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    10
  including commercial applications, and to alter it and redistribute it
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    11
  freely, subject to the following restrictions:
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    12
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    13
  1. The origin of this software must not be misrepresented; you must not
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    14
     claim that you wrote the original software. If you use this software
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    15
     in a product, an acknowledgment in the product documentation would be
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    16
     appreciated but is not required.
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    17
  2. Altered source versions must be plainly marked as such, and must not be
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    18
     misrepresented as being the original software.
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    19
  3. This notice may not be removed or altered from any source distribution.
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    20
*/
8093
b43765095a6f Make internal SDL sources include SDL_internal.h instead of SDL_config.h
Ryan C. Gordon <icculus@icculus.org>
parents: 7759
diff changeset
    21
#include "../SDL_internal.h"
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    22
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    23
#include "SDL_video.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    24
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1643
diff changeset
    25
/* This is the software implementation of the YUV texture support */
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    26
3257
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
    27
struct SDL_SW_YUVTexture
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
    28
{
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
    29
    Uint32 format;
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
    30
    Uint32 target_format;
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
    31
    int w, h;
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
    32
    Uint8 *pixels;
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
    33
    int *colortab;
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
    34
    Uint32 *rgb_2_pix;
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
    35
    void (*Display1X) (int *colortab, Uint32 * rgb_2_pix,
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
    36
                       unsigned char *lum, unsigned char *cr,
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
    37
                       unsigned char *cb, unsigned char *out,
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
    38
                       int rows, int cols, int mod);
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
    39
    void (*Display2X) (int *colortab, Uint32 * rgb_2_pix,
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
    40
                       unsigned char *lum, unsigned char *cr,
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
    41
                       unsigned char *cb, unsigned char *out,
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
    42
                       int rows, int cols, int mod);
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
    43
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
    44
    /* These are just so we don't have to allocate them separately */
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
    45
    Uint16 pitches[3];
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
    46
    Uint8 *planes[3];
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
    47
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
    48
    /* This is a temporary surface in case we have to stretch copy */
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
    49
    SDL_Surface *stretch;
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
    50
    SDL_Surface *display;
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
    51
};
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
    52
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1643
diff changeset
    53
typedef struct SDL_SW_YUVTexture SDL_SW_YUVTexture;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    54
2781
5651642f4a78 Added software fallback for YUV overlay code when YUV textures aren't available.
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
    55
SDL_SW_YUVTexture *SDL_SW_CreateYUVTexture(Uint32 format, int w, int h);
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1643
diff changeset
    56
int SDL_SW_QueryYUVTexturePixels(SDL_SW_YUVTexture * swdata, void **pixels,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1643
diff changeset
    57
                                 int *pitch);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1643
diff changeset
    58
int SDL_SW_UpdateYUVTexture(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1643
diff changeset
    59
                            const void *pixels, int pitch);
7759
869583422e5a Added optimized YUV texture upload path with SDL_UpdateYUVTexture()
Sam Lantinga <slouken@libsdl.org>
parents: 6885
diff changeset
    60
int SDL_SW_UpdateYUVTexturePlanar(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect,
869583422e5a Added optimized YUV texture upload path with SDL_UpdateYUVTexture()
Sam Lantinga <slouken@libsdl.org>
parents: 6885
diff changeset
    61
                                  const Uint8 *Yplane, int Ypitch,
869583422e5a Added optimized YUV texture upload path with SDL_UpdateYUVTexture()
Sam Lantinga <slouken@libsdl.org>
parents: 6885
diff changeset
    62
                                  const Uint8 *Uplane, int Upitch,
869583422e5a Added optimized YUV texture upload path with SDL_UpdateYUVTexture()
Sam Lantinga <slouken@libsdl.org>
parents: 6885
diff changeset
    63
                                  const Uint8 *Vplane, int Vpitch);
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1643
diff changeset
    64
int SDL_SW_LockYUVTexture(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect,
5156
307ccc9c135e Made it possible to create a texture of any format, even if not supported by the renderer.
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
    65
                          void **pixels, int *pitch);
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1643
diff changeset
    66
void SDL_SW_UnlockYUVTexture(SDL_SW_YUVTexture * swdata);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1643
diff changeset
    67
int SDL_SW_CopyYUVToRGB(SDL_SW_YUVTexture * swdata, const SDL_Rect * srcrect,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1643
diff changeset
    68
                        Uint32 target_format, int w, int h, void *pixels,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1643
diff changeset
    69
                        int pitch);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1643
diff changeset
    70
void SDL_SW_DestroyYUVTexture(SDL_SW_YUVTexture * swdata);
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    71
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1643
diff changeset
    72
/* vi: set ts=4 sw=4 expandtab: */