]> granicus.if.org Git - handbrake/commitdiff
Adding File headers, cl.h header for Apple, more Tabs -> spaces.
authorsr55 <sr55.hb@outlook.com>
Fri, 1 Mar 2013 21:08:23 +0000 (21:08 +0000)
committersr55 <sr55.hb@outlook.com>
Fri, 1 Mar 2013 21:08:23 +0000 (21:08 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/branches/opencl@5280 b64f7644-9d1e-0410-96f1-a4d463321fa5

libhb/cropscale.c
libhb/oclnv12toyuv.h
libhb/openclkernels.h
libhb/openclwrapper.c
libhb/scale.c
libhb/scale.h
libhb/scale_kernel.c
libhb/scale_kernel.h
libhb/vadxva2.c
libhb/vadxva2.h

index d2de647fc9d60a7002030854bdb14fd6e2584616..1614b65f20ecf429ea3d9b4375cc2c01266be416 100644 (file)
@@ -14,7 +14,7 @@
 
 struct hb_filter_private_s
 {
-       hb_job_t            * job;
+    hb_job_t            * job;
     int                 width_in;
     int                 height_in;
     int                 pix_fmt;
@@ -28,7 +28,7 @@ struct hb_filter_private_s
     int                 use_decomb;
     int                 use_detelecine;
     hb_oclscale_t       * os; //ocl scaler handler
-#endif 
+#endif    
     struct SwsContext * context;
 };
 
@@ -63,7 +63,7 @@ static int hb_crop_scale_init( hb_filter_object_t * filter,
     hb_filter_private_t * pv = filter->private_data;
 
     // TODO: add pix format option to settings
-       pv->job = init->job;
+    pv->job = init->job;
     pv->pix_fmt_out = init->pix_fmt;
     pv->width_in = init->width;
     pv->height_in = init->height;
@@ -74,9 +74,9 @@ static int hb_crop_scale_init( hb_filter_object_t * filter,
     pv->use_decomb = init->job->use_decomb;
     pv->use_detelecine = init->job->use_detelecine;
 
-       if ( pv->job->use_opencl )
+    if ( pv->job->use_opencl )
     {
-       pv->os = ( hb_oclscale_t * )malloc( sizeof( hb_oclscale_t ) );
+    pv->os = ( hb_oclscale_t * )malloc( sizeof( hb_oclscale_t ) );
         memset( pv->os, 0, sizeof( hb_oclscale_t ) );
     }
 #endif
@@ -138,9 +138,9 @@ static void hb_crop_scale_close( hb_filter_object_t * filter )
     }
 #ifdef USE_OPENCL
 
-       if ( pv->job->use_opencl && pv->os )
+    if ( pv->job->use_opencl && pv->os )
     {
-       CL_FREE( pv->os->h_in_buf );
+    CL_FREE( pv->os->h_in_buf );
         CL_FREE( pv->os->h_out_buf );
         CL_FREE( pv->os->v_out_buf );
         CL_FREE( pv->os->h_coeff_y );
@@ -198,73 +198,73 @@ static hb_buffer_t* crop_scale( hb_filter_private_t * pv, hb_buffer_t * in )
 
 #ifdef USE_OPENCL
 
-       if ( pv->job->use_opencl )
+    if ( pv->job->use_opencl )
     {
-       int w = in->f.width - ( pv->crop[2] + pv->crop[3] );
-       int h = in->f.height - ( pv->crop[0] + pv->crop[1] );
-       uint8_t *tmp_in = malloc( w * h * 3 / 2 );
-       uint8_t *tmp_out = malloc( pv->width_out * pv->height_out * 3 / 2 );
-       if( pic_crop.data[0] || pic_crop.data[1] || pic_crop.data[2] || pic_crop.data[3] )
-       {
-           int i;
-           for( i = 0; i< h>>1; i++ )
-           {
-               memcpy( tmp_in + ( ( i<<1 ) + 0 ) * w, pic_crop.data[0]+ ( ( i<<1 ) + 0 ) * pic_crop.linesize[0], w );
-               memcpy( tmp_in + ( ( i<<1 ) + 1 ) * w, pic_crop.data[0]+ ( ( i<<1 ) + 1 ) * pic_crop.linesize[0], w );
-               memcpy( tmp_in + ( w * h ) + i * ( w>>1 ), pic_crop.data[1] + i * pic_crop.linesize[1], w >> 1 );
-               memcpy( tmp_in + ( w * h ) + ( ( w * h )>>2 ) + i * ( w>>1 ), pic_crop.data[2] + i * pic_crop.linesize[2], w >> 1 );
-           }
-       }
-       else
-       {
-           memcpy( tmp_in, pic_crop.data[0], w * h );
-           memcpy( tmp_in + w * h, pic_crop.data[1], (w*h)>>2 );
-           memcpy( tmp_in + w * h + ((w*h)>>2), pic_crop.data[2], (w*h)>>2 );
-       }
-       hb_ocl_scale( NULL, tmp_in, tmp_out, w, h, out->f.width, out->f.height, pv->os );
-       w = out->plane[0].stride;
-       h = out->plane[0].height;
-       uint8_t *dst = out->plane[0].data;
-       copy_plane( dst, tmp_out, w, pv->width_out, h );
-       w = out->plane[1].stride;
-       h = out->plane[1].height;
-       dst = out->plane[1].data;
-       copy_plane( dst, tmp_out + pv->width_out * pv->height_out, w, pv->width_out>>1, h );
-       w = out->plane[2].stride;
-       h = out->plane[2].height;
-       dst = out->plane[2].data;
-       copy_plane( dst, tmp_out + pv->width_out * pv->height_out +( ( pv->width_out * pv->height_out )>>2 ), w, pv->width_out>>1, h );
-       free( tmp_out );
-       free( tmp_in );
+    int w = in->f.width - ( pv->crop[2] + pv->crop[3] );
+    int h = in->f.height - ( pv->crop[0] + pv->crop[1] );
+    uint8_t *tmp_in = malloc( w * h * 3 / 2 );
+    uint8_t *tmp_out = malloc( pv->width_out * pv->height_out * 3 / 2 );
+    if( pic_crop.data[0] || pic_crop.data[1] || pic_crop.data[2] || pic_crop.data[3] )
+    {
+        int i;
+        for( i = 0; i< h>>1; i++ )
+        {
+            memcpy( tmp_in + ( ( i<<1 ) + 0 ) * w, pic_crop.data[0]+ ( ( i<<1 ) + 0 ) * pic_crop.linesize[0], w );
+            memcpy( tmp_in + ( ( i<<1 ) + 1 ) * w, pic_crop.data[0]+ ( ( i<<1 ) + 1 ) * pic_crop.linesize[0], w );
+            memcpy( tmp_in + ( w * h ) + i * ( w>>1 ), pic_crop.data[1] + i * pic_crop.linesize[1], w >> 1 );
+            memcpy( tmp_in + ( w * h ) + ( ( w * h )>>2 ) + i * ( w>>1 ), pic_crop.data[2] + i * pic_crop.linesize[2], w >> 1 );
+        }
+    }
+    else
+    {
+        memcpy( tmp_in, pic_crop.data[0], w * h );
+        memcpy( tmp_in + w * h, pic_crop.data[1], (w*h)>>2 );
+        memcpy( tmp_in + w * h + ((w*h)>>2), pic_crop.data[2], (w*h)>>2 );
+    }
+    hb_ocl_scale( NULL, tmp_in, tmp_out, w, h, out->f.width, out->f.height, pv->os );
+    w = out->plane[0].stride;
+    h = out->plane[0].height;
+    uint8_t *dst = out->plane[0].data;
+    copy_plane( dst, tmp_out, w, pv->width_out, h );
+    w = out->plane[1].stride;
+    h = out->plane[1].height;
+    dst = out->plane[1].data;
+    copy_plane( dst, tmp_out + pv->width_out * pv->height_out, w, pv->width_out>>1, h );
+    w = out->plane[2].stride;
+    h = out->plane[2].height;
+    dst = out->plane[2].data;
+    copy_plane( dst, tmp_out + pv->width_out * pv->height_out +( ( pv->width_out * pv->height_out )>>2 ), w, pv->width_out>>1, h );
+    free( tmp_out );
+    free( tmp_in );
     }
     else
     {
-       if ( !pv->context ||
-            pv->width_in   != in->f.width  ||
-            pv->height_in  != in->f.height ||
-            pv->pix_fmt != in->f.fmt )
-       {
-           // Something changed, need a new scaling context.
-           if( pv->context )
-               sws_freeContext( pv->context );
-               pv->context = hb_sws_get_context(
-                                       in->f.width  - (pv->crop[2] + pv->crop[3]),
-                                       in->f.height - (pv->crop[0] + pv->crop[1]),
-                                       in->f.fmt,
-                                       out->f.width, out->f.height, out->f.fmt,
-                                       SWS_LANCZOS | SWS_ACCURATE_RND );
-               pv->width_in = in->f.width;
-               pv->height_in = in->f.height;
-               pv->pix_fmt = in->f.fmt;
+    if ( !pv->context ||
+         pv->width_in   != in->f.width  ||
+         pv->height_in  != in->f.height ||
+         pv->pix_fmt != in->f.fmt )
+    {
+        // Something changed, need a new scaling context.
+        if( pv->context )
+            sws_freeContext( pv->context );
+            pv->context = hb_sws_get_context(
+                                    in->f.width  - (pv->crop[2] + pv->crop[3]),
+                                    in->f.height - (pv->crop[0] + pv->crop[1]),
+                                    in->f.fmt,
+                                    out->f.width, out->f.height, out->f.fmt,
+                                    SWS_LANCZOS | SWS_ACCURATE_RND );
+            pv->width_in = in->f.width;
+            pv->height_in = in->f.height;
+            pv->pix_fmt = in->f.fmt;
         }
 
-           // Scale pic_crop into pic_render according to the
-           // context set up above
-       sws_scale(pv->context,
-                     (const uint8_t* const*)pic_crop.data,
-                     pic_crop.linesize,
-                     0, in->f.height - (pv->crop[0] + pv->crop[1]),
-                     pic_out.data,  pic_out.linesize);
+        // Scale pic_crop into pic_render according to the
+        // context set up above
+    sws_scale(pv->context,
+                  (const uint8_t* const*)pic_crop.data,
+                  pic_crop.linesize,
+                  0, in->f.height - (pv->crop[0] + pv->crop[1]),
+                  pic_out.data,  pic_out.linesize);
     }
 #else
     if ( !pv->context ||
index 28e09a8a55ecc1aea2f3f2be6a6063b51b3ad691..7dc104cff02e840a6af2246fad5bf5a369835e34 100644 (file)
@@ -1,6 +1,6 @@
 /* oclnv12toyuv.h
 
-    Copyright (c) 2003-2012 HandBrake Team
+   Copyright (c) 2003-2012 HandBrake Team
    This file is part of the HandBrake source code
    Homepage: <http://handbrake.fr/>.
    It may be used under the terms of the GNU General Public License v2.
 #ifdef USE_OPENCL
 #ifndef RENDER_CL_H
 #define RENDER_CL_H
-#include "CL/cl.h"
+
+#if defined(__APPLE__)
+#include <OpenCL/cl.h>
+#else
+#include <CL/cl.h>
+#endif
+
 #include "common.h"
 #include "openclwrapper.h"
 
+
+
 /**
  * nv12 to yuv interface
  * bufi is input frame of nv12, w is input frame width, h is input frame height
index c8399972bd01939b180830c6015417cbaf846eb0..3bbe8dacad3c0ff6cb49a4fadabd403fa1e8323c 100644 (file)
@@ -1,3 +1,16 @@
+/* openclkernels.h\r
+\r
+   Copyright (c) 2003-2012 HandBrake Team\r
+   This file is part of the HandBrake source code\r
+   Homepage: <http://handbrake.fr/>.\r
+   It may be used under the terms of the GNU General Public License v2.\r
+   For full terms see the file COPYING file or visit http://www.gnu.org/licenses/gpl-2.0.html\r
+   \r
+   Authors: Peng Gao <peng@multicorewareinc.com> <http://www.multicorewareinc.com/>\r
+            Li   Cao <li@multicorewareinc.com> <http://www.multicorewareinc.com/>\r
+\r
+ */\r
\r
 #ifndef USE_EXTERNAL_KERNEL\r
 \r
 #define KERNEL( ... )# __VA_ARGS__\r
index 7dd72d95011ad3055ec0c461831b2e6a3632be5a..a30529904dd59d88a1268d54be0e9df44ed1e4bf 100644 (file)
@@ -1,4 +1,3 @@
-\r
 /* openclwrapper.c\r
 \r
    Copyright (c) 2003-2012 HandBrake Team\r
@@ -10,6 +9,7 @@
    Authors: Peng Gao <peng@multicorewareinc.com> <http://www.multicorewareinc.com/>\r
             Li   Cao <li@multicorewareinc.com> <http://www.multicorewareinc.com/>\r
  */\r
\r
 #ifdef USE_OPENCL\r
 \r
 #include <stdio.h>\r
index 5c92105fc07ce14d93922096771822b43420b4d9..ae2b8681e4ad89a9ede65cb5c7738825f67c73b9 100644 (file)
@@ -1,3 +1,17 @@
+/* scale.c\r
+\r
+   Copyright (c) 2003-2012 HandBrake Team\r
+   This file is part of the HandBrake source code\r
+   Homepage: <http://handbrake.fr/>.\r
+   It may be used under the terms of the GNU General Public License v2.\r
+   For full terms see the file COPYING file or visit http://www.gnu.org/licenses/gpl-2.0.html\r
+\r
+   Authors: Peng Gao <peng@multicorewareinc.com> <http://www.multicorewareinc.com/>\r
+            Li   Cao <li@multicorewareinc.com> <http://www.multicorewareinc.com/>\r
+\r
+\r
+ */\r
\r
 #ifdef USE_OPENCL\r
 #include <assert.h>\r
 #include <stdio.h>\r
index f80ebb15b5cfd2776a34848c65949346fe62a7fd..5bf6f82adeb0f622caf68d52e860c3a15dd52ef4 100644 (file)
@@ -1,3 +1,17 @@
+/* scale.h\r
+\r
+   Copyright (c) 2003-2012 HandBrake Team\r
+   This file is part of the HandBrake source code\r
+   Homepage: <http://handbrake.fr/>.\r
+   It may be used under the terms of the GNU General Public License v2.\r
+   For full terms see the file COPYING file or visit http://www.gnu.org/licenses/gpl-2.0.html\r
+\r
+   Authors: Peng Gao <peng@multicorewareinc.com> <http://www.multicorewareinc.com/>\r
+            Li   Cao <li@multicorewareinc.com> <http://www.multicorewareinc.com/>\r
+\r
+\r
+ */\r
\r
 #ifndef SCALE_H\r
 #define SCALE_H\r
 #ifdef USE_OPENCL\r
index 27d4441160b497ef51a3461a776c4debc2c05685..6404bb96e1e27443a010a139930f098adf7bcb67 100644 (file)
@@ -1,4 +1,17 @@
+/* scale_kernel.h\r
 \r
+   Copyright (c) 2003-2012 HandBrake Team\r
+   This file is part of the HandBrake source code\r
+   Homepage: <http://handbrake.fr/>.\r
+   It may be used under the terms of the GNU General Public License v2.\r
+   For full terms see the file COPYING file or visit http://www.gnu.org/licenses/gpl-2.0.html\r
+\r
+   Authors: Peng Gao <peng@multicorewareinc.com> <http://www.multicorewareinc.com/>\r
+            Li   Cao <li@multicorewareinc.com> <http://www.multicorewareinc.com/>\r
+\r
+\r
+ */\r
\r
 #ifdef USE_OPENCL\r
 #include <assert.h>\r
 #include <math.h>\r
index 29562bdaf9db2d4f54bc5f36444e4754145e49dd..ce413382f319a1956b09d9e3789349f81781e2db 100644 (file)
@@ -1,3 +1,17 @@
+/* scale_kernel.h
+
+   Copyright (c) 2003-2012 HandBrake Team
+   This file is part of the HandBrake source code
+   Homepage: <http://handbrake.fr/>.
+   It may be used under the terms of the GNU General Public License v2.
+   For full terms see the file COPYING file or visit http://www.gnu.org/licenses/gpl-2.0.html
+
+   Authors: Peng Gao <peng@multicorewareinc.com> <http://www.multicorewareinc.com/>
+            Li   Cao <li@multicorewareinc.com> <http://www.multicorewareinc.com/>
+
+
+ */
 #ifndef _H_SCALE_KERNEL_H
 #define _H_SCALE_KERNEL_H
 #ifdef USE_OPENCL
index 0ba8dfa4b60431dbb5b569a5a49c4401abef92a8..2b3bc5fc1e6aa66569ddd505c66da749e3a29b3d 100644 (file)
 #include "vadxva2.h"
 
 #ifdef USE_OPENCL
-#include "CL/cl.h"
+#if defined(__APPLE__)
+#include <OpenCL/cl.h>
+#else
+#include <CL/cl.h>
+#endif
+
 #include "oclnv12toyuv.h"
 #include "scale.h"
 #endif
index f039db7953fe973bbc0481fb9cf5ca89ed9a8567..63251543bead634547cfa02b8126333fe379fc55 100644 (file)
@@ -11,8 +11,6 @@
 
  */
 
-
-
 #ifndef VA_DXVA2_H
 #define VA_DXVA2_H