[cvs] / vfw / src / codec.c Repository:
ViewVC logotype

Diff of /vfw/src/codec.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.23.2.6, Sun Nov 3 03:22:03 2002 UTC revision 1.24, Sat Sep 21 03:11:05 2002 UTC
# Line 54  Line 54 
54  #include "2pass.h"  #include "2pass.h"
55    
56  int pmvfast_presets[7] = {  int pmvfast_presets[7] = {
57          0, PMV_QUICKSTOP16, 0, 0,          0, PMV_QUICKSTOP16, PMV_EARLYSTOP16, PMV_EARLYSTOP16 | PMV_EARLYSTOP8,
58          0 | PMV_HALFPELREFINE16 | PMV_HALFPELDIAMOND8,          PMV_EARLYSTOP16 | PMV_HALFPELREFINE16 | PMV_EARLYSTOP8 | PMV_HALFPELDIAMOND8,
59          0 | PMV_HALFPELREFINE16 | PMV_HALFPELDIAMOND8 |          PMV_EARLYSTOP16 | PMV_HALFPELREFINE16 | PMV_EARLYSTOP8 | PMV_HALFPELDIAMOND8 |
60          PMV_ADVANCEDDIAMOND16, PMV_HALFPELREFINE16 | PMV_EXTSEARCH16 |          PMV_ADVANCEDDIAMOND16, PMV_EARLYSTOP16 | PMV_HALFPELREFINE16 | PMV_EXTSEARCH16 |
61          PMV_HALFPELREFINE8 | PMV_HALFPELDIAMOND8 | PMV_USESQUARES16          PMV_EARLYSTOP8 | PMV_HALFPELREFINE8 | PMV_HALFPELDIAMOND8 | PMV_USESQUARES16
62  };  };
63    
64  /*      return xvid compatbile colorspace,  /*      return xvid compatbile colorspace,
# Line 67  Line 67 
67    
68  int get_colorspace(BITMAPINFOHEADER * hdr)  int get_colorspace(BITMAPINFOHEADER * hdr)
69  {  {
70          /* rgb only: negative height specifies top down image */          if (hdr->biHeight < 0)
71          int rgb_flip = (hdr->biHeight < 0 ? 0 : XVID_CSP_VFLIP);          {
72                    DEBUGERR("colorspace: inverted input format not supported");
73                    return XVID_CSP_NULL;
74            }
75    
76          switch(hdr->biCompression)          switch(hdr->biCompression)
77          {          {
# Line 76  Line 79 
79                  if (hdr->biBitCount == 16)                  if (hdr->biBitCount == 16)
80                  {                  {
81                          DEBUG("RGB16 (RGB555)");                          DEBUG("RGB16 (RGB555)");
82                          return rgb_flip | XVID_CSP_RGB555;                          return XVID_CSP_VFLIP | XVID_CSP_RGB555;
83                  }                  }
84                  if (hdr->biBitCount == 24)                  if (hdr->biBitCount == 24)
85                  {                  {
86                          DEBUG("RGB24");                          DEBUG("RGB24");
87                          return rgb_flip | XVID_CSP_RGB24;                          return XVID_CSP_VFLIP | XVID_CSP_RGB24;
88                  }                  }
89                  if (hdr->biBitCount == 32)                  if (hdr->biBitCount == 32)
90                  {                  {
91                          DEBUG("RGB32");                          DEBUG("RGB32");
92                          return rgb_flip | XVID_CSP_RGB32;                          return XVID_CSP_VFLIP | XVID_CSP_RGB32;
93                  }                  }
94    
95                  DEBUG1("unsupported BI_RGB biBitCount", hdr->biBitCount);                  DEBUG1("BI_RGB unsupported", hdr->biBitCount);
96                  return XVID_CSP_NULL;                  return XVID_CSP_NULL;
97    
98          case BI_BITFIELDS :  // how do these work in BITMAPINFOHEADER ???
99                  if (hdr->biSize >= sizeof(BITMAPV4HEADER))  /*      case BI_BITFIELDS :
100                  {                  if (hdr->biBitCount == 16
101                          BITMAPV4HEADER * hdr4 = (BITMAPV4HEADER *)hdr;                  if(hdr->biBitCount == 16 &&
102                            hdr->bV4RedMask == 0x7c00 &&
103                          if (hdr4->bV4BitCount == 16 &&                          hdr->bV4GreenMask == 0x3e0 &&
104                                  hdr4->bV4RedMask == 0x7c00 &&                          hdr->bV4BlueMask == 0x1f)
                                 hdr4->bV4GreenMask == 0x3e0 &&  
                                 hdr4->bV4BlueMask == 0x1f)  
105                          {                          {
106                                  DEBUG("RGB555");                                  DEBUG("RGB555");
107                                  return rgb_flip | XVID_CSP_RGB555;                          return XVID_CSP_VFLIP | XVID_CSP_RGB555;
108                          }                          }
109                    if(hdr->bV4BitCount == 16 &&
110                          if(hdr4->bV4BitCount == 16 &&                          hdr->bV4RedMask == 0xf800 &&
111                                  hdr4->bV4RedMask == 0xf800 &&                          hdr->bV4GreenMask == 0x7e0 &&
112                                  hdr4->bV4GreenMask == 0x7e0 &&                          hdr->bV4BlueMask == 0x1f)
                                 hdr4->bV4BlueMask == 0x1f)  
113                          {                          {
114                                  DEBUG("RGB565");                                  DEBUG("RGB565");
115                                  return rgb_flip | XVID_CSP_RGB565;                          return XVID_CSP_VFLIP | XVID_CSP_RGB565;
                         }  
   
                         DEBUG("unsupported BI_BITFIELDS mode");  
                         return XVID_CSP_NULL;  
116                  }                  }
117    
118                  DEBUG("unsupported BI_BITFIELDS/BITMAPHEADER combination");                  DEBUG1("BI_FIELDS unsupported", hdr->bV4BitCount);
119                  return XVID_CSP_NULL;                  return XVID_CSP_NULL;
120    */
121          case FOURCC_I420 :          case FOURCC_I420 :
122          case FOURCC_IYUV :          case FOURCC_IYUV :
123                  DEBUG("IYUY");                  DEBUG("IYUY");
# Line 133  Line 129 
129    
130          case FOURCC_YUYV :          case FOURCC_YUYV :
131          case FOURCC_YUY2 :          case FOURCC_YUY2 :
132            case FOURCC_V422 :
133                  DEBUG("YUY2");                  DEBUG("YUY2");
134                  return XVID_CSP_YUY2;                  return XVID_CSP_YUY2;
135    
# Line 144  Line 141 
141                  DEBUG("UYVY");                  DEBUG("UYVY");
142                  return XVID_CSP_UYVY;                  return XVID_CSP_UYVY;
143    
         default :  
                 DEBUGFOURCC("unsupported colorspace", hdr->biCompression);  
                 return XVID_CSP_NULL;  
144          }          }
145            DEBUGFOURCC("colorspace: unknown", hdr->biCompression);
146            return XVID_CSP_NULL;
147  }  }
148    
149    
# Line 198  Line 194 
194    
195          memcpy(outhdr, inhdr, sizeof(BITMAPINFOHEADER));          memcpy(outhdr, inhdr, sizeof(BITMAPINFOHEADER));
196          outhdr->biSize = sizeof(BITMAPINFOHEADER);          outhdr->biSize = sizeof(BITMAPINFOHEADER);
197            outhdr->biBitCount = 24;  // or 16
198          outhdr->biSizeImage = compress_get_size(codec, lpbiInput, lpbiOutput);          outhdr->biSizeImage = compress_get_size(codec, lpbiInput, lpbiOutput);
199          outhdr->biXPelsPerMeter = 0;          outhdr->biXPelsPerMeter = 0;
200          outhdr->biYPelsPerMeter = 0;          outhdr->biYPelsPerMeter = 0;
# Line 401  Line 398 
398                  frame.general |= XVID_INTERLACING;                  frame.general |= XVID_INTERLACING;
399    
400    
401    
402  // added by koepi for credits greyscale  // added by koepi for credits greyscale
403    
404          check_greyscale_mode(&codec->config, &frame, codec->framenum);          check_greyscale_mode(&codec->config, &frame, codec->framenum);
# Line 450  Line 448 
448          frame.motion = pmvfast_presets[codec->config.motion_search];          frame.motion = pmvfast_presets[codec->config.motion_search];
449    
450          frame.image = icc->lpInput;          frame.image = icc->lpInput;
         // dev-api-3 frame.stride = (((icc->lpbiInput->biWidth * icc->lpbiInput->biBitCount) + 31) & ~31) >> 3;  
451    
452          if ((frame.colorspace = get_colorspace(inhdr)) == XVID_CSP_NULL)          if ((frame.colorspace = get_colorspace(inhdr)) == XVID_CSP_NULL)
453                  return ICERR_BADFORMAT;                  return ICERR_BADFORMAT;
# Line 608  Line 605 
605          {          {
606                  return ICERR_ERROR;                  return ICERR_ERROR;
607          }          }
 /* --- yv12 --- */  
         if (inhdr->biCompression == FOURCC_YV12) {  
                 return ICERR_OK;  
         }  
 /* --- yv12 --- */  
608    
609          if (inhdr->biCompression != FOURCC_XVID && inhdr->biCompression != FOURCC_DIVX)          if (inhdr->biCompression != FOURCC_XVID && inhdr->biCompression != FOURCC_DIVX)
610          {          {
# Line 646  Line 638 
638                  return sizeof(BITMAPINFOHEADER);                  return sizeof(BITMAPINFOHEADER);
639          }          }
640    
         /* --- yv12 --- */  
   
         if (lpbiInput->bmiHeader.biCompression == FOURCC_YV12) {  
                 memcpy(outhdr, inhdr, sizeof(BITMAPINFOHEADER));  
                 return ICERR_OK;  
         }  
         /* --- yv12 --- */  
   
641          result = decompress_query(codec, lpbiInput, lpbiOutput);          result = decompress_query(codec, lpbiInput, lpbiOutput);
642          if (result != ICERR_OK)          if (result != ICERR_OK)
643          {          {
# Line 726  Line 710 
710    
711          frame.image = icd->lpOutput;          frame.image = icd->lpOutput;
712          frame.stride = icd->lpbiOutput->biWidth;          frame.stride = icd->lpbiOutput->biWidth;
         // dev-api-3: frame.stride = (((icd->lpbiOutput->biWidth * icd->lpbiOutput->biBitCount) + 31) & ~31) >> 3;  
   
         /* --- yv12 --- */  
         if (icd->lpbiInput->biCompression == FOURCC_YV12) {  
                 DEBUGFOURCC("output", icd->lpbiOutput->biCompression);  
                 if (icd->lpbiOutput->biCompression == FOURCC_YV12) {  
                         memcpy(frame.image,codec->dhandle,icd->lpbiInput->biSizeImage);  
                 }  
                 return ICERR_OK;  
         }  
         /* --- yv12 --- */  
   
713    
714          if (~((icd->dwFlags & ICDECOMPRESS_HURRYUP) | (icd->dwFlags & ICDECOMPRESS_UPDATE) | (icd->dwFlags & ICDECOMPRESS_PREROLL)))          if (~((icd->dwFlags & ICDECOMPRESS_HURRYUP) | (icd->dwFlags & ICDECOMPRESS_UPDATE) | (icd->dwFlags & ICDECOMPRESS_PREROLL)))
715          {          {

Legend:
Removed from v.1.23.2.6  
changed lines
  Added in v.1.24

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4