summaryrefslogtreecommitdiff
path: root/test/encode
diff options
context:
space:
mode:
authorwangkun <kun.k.wang@intel.com>2011-03-09 13:39:43 +0800
committerJack Ren <jack.ren@intel.com>2011-03-18 21:06:53 +0800
commitcceaa0568f77a7452857559614100b71fb36ee3a (patch)
tree8a11122db42a367a2d1c0e3806f4df17f8ddeef8 /test/encode
parent31b59c0fd16f07350091f974d5b9f05c67299796 (diff)
downloadlibva-cceaa0568f77a7452857559614100b71fb36ee3a.tar.gz
porting the latest libva library codes to gingerbread-stable
Change-Id: Iffbbe35ce1e649a28e9c861bba0716d0007452df
Diffstat (limited to 'test/encode')
l---------[-rw-r--r--]test/encode/loadsurface.h121
1 files changed, 1 insertions, 120 deletions
diff --git a/test/encode/loadsurface.h b/test/encode/loadsurface.h
index ef792c8..fb38e2f 100644..120000
--- a/test/encode/loadsurface.h
+++ b/test/encode/loadsurface.h
@@ -1,120 +1 @@
-/*
- * Copyright (c) 2008-2009 Intel Corporation. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-static int yuvgen_planar(int width, int height,
- unsigned char *Y_start, int Y_pitch,
- unsigned char *U_start, int U_pitch,
- unsigned char *V_start, int V_pitch,
- int UV_interleave, int box_width, int row_shift,
- int field)
-{
- int row;
-
- /* copy Y plane */
- for (row=0;row<height;row++) {
- unsigned char *Y_row = Y_start + row * Y_pitch;
- int jj, xpos, ypos;
-
- ypos = (row / box_width) & 0x1;
-
- /* fill garbage data into the other field */
- if (((field == VA_TOP_FIELD) && (row &1))
- || ((field == VA_BOTTOM_FIELD) && ((row &1)==0))) {
- memset(Y_row, 0xff, width);
- continue;
- }
-
- for (jj=0; jj<width; jj++) {
- xpos = ((row_shift + jj) / box_width) & 0x1;
-
- if ((xpos == 0) && (ypos == 0))
- Y_row[jj] = 0xeb;
- if ((xpos == 1) && (ypos == 1))
- Y_row[jj] = 0xeb;
-
- if ((xpos == 1) && (ypos == 0))
- Y_row[jj] = 0x10;
- if ((xpos == 0) && (ypos == 1))
- Y_row[jj] = 0x10;
- }
- }
-
- /* copy UV data */
- for( row =0; row < height/2; row++) {
- unsigned short value = 0x80;
-
- /* fill garbage data into the other field */
- if (((field == VA_TOP_FIELD) && (row &1))
- || ((field == VA_BOTTOM_FIELD) && ((row &1)==0))) {
- value = 0xff;
- }
-
- if (UV_interleave) {
- unsigned short *UV_row = (unsigned short *)(U_start + row * U_pitch);
-
- memset(UV_row, value, width);
- } else {
- unsigned char *U_row = U_start + row * U_pitch;
- unsigned char *V_row = V_start + row * V_pitch;
-
- memset (U_row,value,width/2);
- memset (V_row,value,width/2);
- }
- }
-
- return 0;
-}
-
-static int upload_surface(VADisplay va_dpy, VASurfaceID surface_id,
- int box_width, int row_shift,
- int field)
-{
- VAImage surface_image;
- void *surface_p=NULL, *U_start,*V_start;
- VAStatus va_status;
-
- va_status = vaDeriveImage(va_dpy,surface_id,&surface_image);
- CHECK_VASTATUS(va_status,"vaDeriveImage");
-
- vaMapBuffer(va_dpy,surface_image.buf,&surface_p);
- assert(VA_STATUS_SUCCESS == va_status);
-
- U_start = surface_p + surface_image.offsets[1];
- V_start = surface_p + surface_image.offsets[2];
-
- /* assume surface is planar format */
- yuvgen_planar(surface_image.width, surface_image.height,
- surface_p, surface_image.pitches[0],
- U_start, surface_image.pitches[1],
- V_start, surface_image.pitches[2],
- (surface_image.format.fourcc==VA_FOURCC_NV12),
- box_width, row_shift, field);
-
- vaUnmapBuffer(va_dpy,surface_image.buf);
-
- vaDestroyImage(va_dpy,surface_image.image_id);
-
- return 0;
-}
+../putsurface/loadsurface.h \ No newline at end of file