Linux kernel & device driver programming

Cross-Referenced Linux and Device Driver Code

[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ]
Version: [ 2.6.11.8 ] [ 2.6.25 ] [ 2.6.25.8 ] [ 2.6.31.13 ] Architecture: [ i386 ]
  1 /* 
  2  * Simple xawtv deinterlacing plugin - bilinear interpolation
  3  * 
  4  * CAVEATS: Effectively halves framerate, (working on it)
  5  * May cause some general slowness (uses more cpu) but the framerate is smooth
  6  * on my athlon 700, running the -mjc branch of 2.4 kernel (preempt and other
  7  * patches for desktop performance)
  8  * Text (in console games for example) looks really ugly
  9  * 
 10  * BENEFITS: It's no longer interlaced ;)
 11  * Looks a metric shitton better than line doubling
 12  * 
 13  * AUTHORS:
 14  * Conrad Kreyling <conrad@conrad.nerdland.org>
 15  * Patrick Barrett <yebyen@nerdland.org>
 16  * 
 17  * This is licenced under the GNU GPL until someone tells me I'm stealing code
 18  * and can't do that ;) www.gnu.org for any version of the license.
 19  *
 20  * Based on xawtv-3.66/libng/plugins/flt-nop.c (also GPL)
 21  */
 22 
 23 
 24 #include "config.h"
 25 
 26 #include <stdio.h>
 27 #include <stdlib.h>
 28 #include <pthread.h>
 29 
 30 #include "grab-ng.h"
 31 
 32 static void inline
 33 deinterlace (struct ng_video_buf *frame)
 34 {
 35   unsigned int x, y;
 36 
 37   for (y = 1; y < frame->fmt.height - 1; y += 2)
 38     for (x = 0; x < frame->fmt.bytesperline + 1; x++)
 39       (frame->data[y * (frame->fmt.bytesperline) + x]) =
 40         ((frame->data[((y - 1) * (frame->fmt.bytesperline)) + x]) +
 41          (frame->data[((y + 1) * (frame->fmt.bytesperline)) + x])) >> 1;
 42 
 43 }
 44 
 45 
 46 static void *
 47 init (struct ng_video_fmt *out)
 48 {
 49   /* don't have to carry around status info */
 50   static int dummy;
 51   return &dummy;
 52 }
 53 
 54 static struct ng_video_buf *
 55 frame (void *handle, struct ng_video_buf *frame)
 56 {
 57   deinterlace (frame);          // In hindsight, we may not have needed the function ;)
 58   // Added clarity when we make it more complicated.
 59   return frame;
 60 }
 61 
 62 static void
 63 fini (void *handle)
 64 {
 65   /* nothing to clean up */
 66 }
 67 
 68 /* ------------------------------------------------------------------- */
 69 
 70 static struct ng_filter filter = {
 71   name:"bilinear deinterlace",
 72   fmts:
 73     (1 << VIDEO_GRAY)   |
 74     (1 << VIDEO_RGB15_NATIVE) |
 75     (1 << VIDEO_RGB16_NATIVE) |
 76     (1 << VIDEO_BGR24)  |
 77     (1 << VIDEO_RGB24)  |
 78     (1 << VIDEO_BGR32)  |
 79     (1 << VIDEO_RGB32)  |
 80     (1 << VIDEO_YUYV)   |
 81     (1 << VIDEO_UYVY),
 82   init:init,
 83   frame:frame,
 84   fini:fini,
 85 };
 86 
 87 extern void ng_plugin_init (void);
 88 void
 89 ng_plugin_init (void)
 90 {
 91   ng_filter_register (NG_PLUGIN_MAGIC,__FILE__,&filter);
 92 }
 93 
  This page was automatically generated by the LXR engine.