[svn] / branches / release-1_0-branch / xvidcore / vfw / src / codec.c Repository:
ViewVC logotype

Diff of /branches/release-1_0-branch/xvidcore/vfw/src/codec.c

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

revision 1562, Mon Nov 22 10:40:03 2004 UTC revision 1563, Wed Nov 24 22:14:11 2004 UTC
# Line 642  Line 642 
642          }          }
643  }  }
644    
645    #define CALC_BI_STRIDE(width,bitcount)  ((((width * bitcount) + 31) & ~31) >> 3)
646    
647  LRESULT compress(CODEC * codec, ICCOMPRESS * icc)  LRESULT compress(CODEC * codec, ICCOMPRESS * icc)
648  {  {
# Line 772  Line 773 
773          }          }
774    
775          frame.input.plane[0] = icc->lpInput;          frame.input.plane[0] = icc->lpInput;
776          frame.input.stride[0] = (((icc->lpbiInput->biWidth * icc->lpbiInput->biBitCount) + 31) & ~31) >> 3;          frame.input.stride[0] = CALC_BI_STRIDE(icc->lpbiInput->biWidth, icc->lpbiInput->biBitCount);
777    
778          if ((frame.input.csp = get_colorspace(inhdr)) == XVID_CSP_NULL)          if ((frame.input.csp = get_colorspace(inhdr)) == XVID_CSP_NULL)
779                  return ICERR_BADFORMAT;                  return ICERR_BADFORMAT;
# Line 925  Line 926 
926          outhdr->biPlanes = 1;          outhdr->biPlanes = 1;
927          outhdr->biBitCount = 24;          outhdr->biBitCount = 24;
928          outhdr->biCompression = BI_RGB; /* sonic foundry vegas video v3 only supports BI_RGB */          outhdr->biCompression = BI_RGB; /* sonic foundry vegas video v3 only supports BI_RGB */
929          outhdr->biSizeImage = outhdr->biWidth * outhdr->biHeight * outhdr->biBitCount / 8;          outhdr->biSizeImage = outhdr->biWidth * CALC_BI_STRIDE(outhdr->biHeight, outhdr->biBitCount);
930          outhdr->biXPelsPerMeter = 0;          outhdr->biXPelsPerMeter = 0;
931          outhdr->biYPelsPerMeter = 0;          outhdr->biYPelsPerMeter = 0;
932          outhdr->biClrUsed = 0;          outhdr->biClrUsed = 0;
# Line 1029  Line 1030 
1030    
1031                  convert.input.csp = get_colorspace(icd->lpbiInput);                  convert.input.csp = get_colorspace(icd->lpbiInput);
1032                  convert.input.plane[0] = icd->lpInput;                  convert.input.plane[0] = icd->lpInput;
1033                  convert.input.stride[0] = (((icd->lpbiInput->biWidth *icd->lpbiInput->biBitCount) + 31) & ~31) >> 3;                  convert.input.stride[0] = CALC_BI_STRIDE(icd->lpbiInput->biWidth, icd->lpbiInput->biBitCount);
1034                  if (convert.input.csp == XVID_CSP_I420 || convert.input.csp == XVID_CSP_YV12)                  if (convert.input.csp == XVID_CSP_I420 || convert.input.csp == XVID_CSP_YV12)
1035                          convert.input.stride[0] = (convert.input.stride[0]*2)/3;                          convert.input.stride[0] = (convert.input.stride[0]*2)/3;
1036    
1037                  convert.output.csp = get_colorspace(icd->lpbiOutput);                  convert.output.csp = get_colorspace(icd->lpbiOutput);
1038                  convert.output.plane[0] = icd->lpOutput;                  convert.output.plane[0] = icd->lpOutput;
1039                  convert.output.stride[0] = (((icd->lpbiOutput->biWidth *icd->lpbiOutput->biBitCount) + 31) & ~31) >> 3;                  convert.output.stride[0] = CALC_BI_STRIDE(icd->lpbiOutput->biWidth, icd->lpbiOutput->biBitCount);
1040                  if (convert.output.csp == XVID_CSP_I420 || convert.output.csp == XVID_CSP_YV12)                  if (convert.output.csp == XVID_CSP_I420 || convert.output.csp == XVID_CSP_YV12)
1041                          convert.output.stride[0] = (convert.output.stride[0]*2)/3;                          convert.output.stride[0] = (convert.output.stride[0]*2)/3;
1042    
# Line 1065  Line 1066 
1066                          return ICERR_BADFORMAT;                          return ICERR_BADFORMAT;
1067                  }                  }
1068                  frame.output.plane[0] = icd->lpOutput;                  frame.output.plane[0] = icd->lpOutput;
1069                  frame.output.stride[0] = (((icd->lpbiOutput->biWidth * icd->lpbiOutput->biBitCount) + 31) & ~31) >> 3;                  frame.output.stride[0] = CALC_BI_STRIDE(icd->lpbiOutput->biWidth, icd->lpbiOutput->biBitCount);
1070                  if (frame.output.csp == XVID_CSP_I420 || frame.output.csp == XVID_CSP_YV12)                  if (frame.output.csp == XVID_CSP_I420 || frame.output.csp == XVID_CSP_YV12)
1071                          frame.output.stride[0] = (frame.output.stride[0]*2)/3;                          frame.output.stride[0] = CALC_BI_STRIDE(icd->lpbiOutput->biWidth, 8);
1072          }          }
1073          else          else
1074          {          {

Legend:
Removed from v.1562  
changed lines
  Added in v.1563

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