~ubuntu-branches/ubuntu/trusty/gavl/trusty

« back to all changes in this revision

Viewing changes to gavl/colorspace.c

  • Committer: Bazaar Package Importer
  • Author(s): Romain Beauxis
  • Date: 2009-01-17 20:38:33 UTC
  • mfrom: (1.1.3 upstream) (4.1.1 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090117203833-t8fq1e1jdquyelmy
Tags: 1.1.0-2
Fixed debian/copyright 

Show diffs side-by-side

added added

removed removed

Lines of Context:
5005
5005
    }
5006
5006
  return GAVL_PIXELFORMAT_NONE;
5007
5007
  }
 
5008
 
 
5009
void gavl_pixelformat_get_offset(gavl_pixelformat_t pixelformat,
 
5010
                                 int plane,
 
5011
                                 int * advance, int * offset)
 
5012
  {
 
5013
  switch(pixelformat)
 
5014
    {
 
5015
    case GAVL_PIXELFORMAT_NONE:
 
5016
      break;
 
5017
    case GAVL_RGB_15:
 
5018
    case GAVL_BGR_15:
 
5019
      *advance = 2;
 
5020
      *offset = 0;
 
5021
      break;
 
5022
    case GAVL_GRAY_8:
 
5023
      *advance = 1;
 
5024
      *offset = 0;
 
5025
      break;
 
5026
    case GAVL_RGB_16:
 
5027
    case GAVL_BGR_16:
 
5028
    case GAVL_GRAY_16:
 
5029
    case GAVL_GRAYA_16:
 
5030
      *advance = 2;
 
5031
      *offset = 0;
 
5032
      break;
 
5033
    case GAVL_RGB_24:
 
5034
    case GAVL_BGR_24:
 
5035
      *advance = 3;
 
5036
      *offset = 0;
 
5037
      break;
 
5038
    case GAVL_RGB_32:
 
5039
    case GAVL_BGR_32:
 
5040
    case GAVL_YUVA_32:
 
5041
    case GAVL_RGBA_32:
 
5042
    case GAVL_GRAYA_32:
 
5043
      *advance = 4;
 
5044
      *offset = 0;
 
5045
      break;
 
5046
    case GAVL_YUY2:
 
5047
      switch(plane)
 
5048
        {
 
5049
        /* YUYV */
 
5050
        case 0:
 
5051
          *advance = 2;
 
5052
          *offset = 0;
 
5053
          break;
 
5054
        case 1:
 
5055
          *advance = 4;
 
5056
          *offset = 1;
 
5057
          break;
 
5058
        case 2:
 
5059
          *advance = 4;
 
5060
          *offset = 3;
 
5061
          break;
 
5062
        }
 
5063
      break;
 
5064
    case GAVL_UYVY:
 
5065
      switch(plane)
 
5066
        {
 
5067
        /* UYVY */
 
5068
        case 0:
 
5069
          *advance = 2;
 
5070
          *offset = 1;
 
5071
          break;
 
5072
        case 1:
 
5073
          *advance = 4;
 
5074
          *offset = 0;
 
5075
          break;
 
5076
        case 2:
 
5077
          *advance = 4;
 
5078
          *offset = 2;
 
5079
          break;
 
5080
        }
 
5081
      break;
 
5082
    case GAVL_YUV_420_P:
 
5083
    case GAVL_YUV_422_P:
 
5084
    case GAVL_YUV_444_P:
 
5085
    case GAVL_YUV_411_P:
 
5086
    case GAVL_YUV_410_P:
 
5087
      *advance = 1;
 
5088
      *offset = 0;
 
5089
      break;
 
5090
    case GAVL_YUVJ_420_P:
 
5091
    case GAVL_YUVJ_422_P:
 
5092
    case GAVL_YUVJ_444_P:
 
5093
      *advance = 1;
 
5094
      *offset = 0;
 
5095
      break;
 
5096
    case GAVL_YUV_444_P_16:
 
5097
    case GAVL_YUV_422_P_16:
 
5098
      *advance = 2;
 
5099
      *offset = 0;
 
5100
      break;
 
5101
    case GAVL_RGB_48:
 
5102
      *advance = 6;
 
5103
      *offset = 0;
 
5104
      break;
 
5105
    case GAVL_RGBA_64:
 
5106
    case GAVL_YUVA_64:
 
5107
      *advance = 8;
 
5108
      *offset = 0;
 
5109
      break;
 
5110
    case GAVL_GRAY_FLOAT:
 
5111
      *advance = sizeof(float);
 
5112
      *offset = 0;
 
5113
      break;
 
5114
    case GAVL_GRAYA_FLOAT:
 
5115
      *advance = 2 * sizeof(float);
 
5116
      *offset = 0;
 
5117
      break;
 
5118
    case GAVL_RGB_FLOAT:
 
5119
    case GAVL_YUV_FLOAT:
 
5120
      *advance = 3 * sizeof(float);
 
5121
      *offset = 0;
 
5122
      break;
 
5123
    case GAVL_RGBA_FLOAT:
 
5124
    case GAVL_YUVA_FLOAT:
 
5125
      *advance = 4 * sizeof(float);
 
5126
      *offset = 0;
 
5127
      break;
 
5128
    }
 
5129
 
 
5130
  }
 
5131