19 |
* along with this program; if not, write to the Free Software |
* along with this program; if not, write to the Free Software |
20 |
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
21 |
* |
* |
22 |
* $Id: codec.c,v 1.31 2010-12-30 22:08:02 Isibaar Exp $ |
* $Id$ |
23 |
* |
* |
24 |
*************************************************************************/ |
*************************************************************************/ |
25 |
|
|
159 |
return ICERR_BADFORMAT; |
return ICERR_BADFORMAT; |
160 |
} |
} |
161 |
|
|
162 |
|
if ((inhdr->biWidth % 4) || (inhdr->biHeight % 4)) |
163 |
|
{ |
164 |
|
return ICERR_BADFORMAT; |
165 |
|
} |
166 |
|
|
167 |
if (lpbiOutput == NULL) |
if (lpbiOutput == NULL) |
168 |
{ |
{ |
169 |
return ICERR_OK; |
return ICERR_OK; |
565 |
create.num_plugins++; |
create.num_plugins++; |
566 |
} |
} |
567 |
|
|
568 |
|
if (codec->config.debug > 0) { |
569 |
plugins[create.num_plugins].func = vfw_debug; |
plugins[create.num_plugins].func = vfw_debug; |
570 |
plugins[create.num_plugins].param = NULL; |
plugins[create.num_plugins].param = NULL; |
571 |
create.num_plugins++; |
create.num_plugins++; |
572 |
|
} |
573 |
|
|
574 |
create.profile = profiles[codec->config.profile].id; |
create.profile = profiles[codec->config.profile].id; |
575 |
|
|
615 |
if ((profiles[codec->config.profile].flags & PROFILE_EXTRA)) |
if ((profiles[codec->config.profile].flags & PROFILE_EXTRA)) |
616 |
create.global |= XVID_GLOBAL_DIVX5_USERDATA; |
create.global |= XVID_GLOBAL_DIVX5_USERDATA; |
617 |
|
|
618 |
|
if ((profiles[codec->config.profile].flags & PROFILE_EXTRA) || |
619 |
|
(profiles[codec->config.profile].flags & PROFILE_XVID)) { |
620 |
|
create.frame_drop_ratio = 0; |
621 |
|
} else { |
622 |
create.frame_drop_ratio = quality_preset->frame_drop_ratio; |
create.frame_drop_ratio = quality_preset->frame_drop_ratio; |
623 |
|
} |
624 |
|
|
625 |
switch(codec->xvid_encore_func(0, XVID_ENC_CREATE, &create, NULL)) |
switch(codec->xvid_encore_func(0, XVID_ENC_CREATE, &create, NULL)) |
626 |
{ |
{ |
931 |
{ |
{ |
932 |
BITMAPINFOHEADER * inhdr = &lpbiInput->bmiHeader; |
BITMAPINFOHEADER * inhdr = &lpbiInput->bmiHeader; |
933 |
BITMAPINFOHEADER * outhdr = &lpbiOutput->bmiHeader; |
BITMAPINFOHEADER * outhdr = &lpbiOutput->bmiHeader; |
934 |
|
int in_csp = XVID_CSP_NULL, out_csp = XVID_CSP_NULL; |
935 |
|
|
936 |
if (lpbiInput == NULL) |
if (lpbiInput == NULL) |
937 |
{ |
{ |
938 |
return ICERR_ERROR; |
return ICERR_ERROR; |
939 |
} |
} |
940 |
|
|
941 |
if (inhdr->biCompression != FOURCC_XVID && inhdr->biCompression != FOURCC_DIVX && inhdr->biCompression != FOURCC_DX50 && get_colorspace(inhdr) == XVID_CSP_NULL) |
if (inhdr->biCompression != FOURCC_XVID && inhdr->biCompression != FOURCC_DIVX && inhdr->biCompression != FOURCC_DX50 && inhdr->biCompression != FOURCC_MP4V && |
942 |
|
inhdr->biCompression != FOURCC_xvid && inhdr->biCompression != FOURCC_divx && inhdr->biCompression != FOURCC_dx50 && inhdr->biCompression != FOURCC_mp4v && |
943 |
|
(in_csp = get_colorspace(inhdr)) != XVID_CSP_YV12) |
944 |
{ |
{ |
945 |
return ICERR_BADFORMAT; |
return ICERR_BADFORMAT; |
946 |
} |
} |
950 |
return ICERR_OK; |
return ICERR_OK; |
951 |
} |
} |
952 |
|
|
953 |
|
out_csp = get_colorspace(outhdr); |
954 |
|
|
955 |
if (inhdr->biWidth != outhdr->biWidth || |
if (inhdr->biWidth != outhdr->biWidth || |
956 |
inhdr->biHeight != outhdr->biHeight || |
inhdr->biHeight != outhdr->biHeight || |
957 |
get_colorspace(outhdr) == XVID_CSP_NULL) |
out_csp == XVID_CSP_NULL || |
958 |
|
(in_csp == XVID_CSP_YV12 && in_csp != out_csp)) |
959 |
{ |
{ |
960 |
return ICERR_BADFORMAT; |
return ICERR_BADFORMAT; |
961 |
} |
} |
1098 |
/* --- yv12 --- */ |
/* --- yv12 --- */ |
1099 |
if (icd->lpbiInput->biCompression != FOURCC_XVID && |
if (icd->lpbiInput->biCompression != FOURCC_XVID && |
1100 |
icd->lpbiInput->biCompression != FOURCC_DIVX && |
icd->lpbiInput->biCompression != FOURCC_DIVX && |
1101 |
icd->lpbiInput->biCompression != FOURCC_DX50) |
icd->lpbiInput->biCompression != FOURCC_DX50 && |
1102 |
|
icd->lpbiInput->biCompression != FOURCC_MP4V && |
1103 |
|
icd->lpbiInput->biCompression != FOURCC_xvid && |
1104 |
|
icd->lpbiInput->biCompression != FOURCC_divx && |
1105 |
|
icd->lpbiInput->biCompression != FOURCC_dx50 && |
1106 |
|
icd->lpbiInput->biCompression != FOURCC_mp4v) |
1107 |
{ |
{ |
1108 |
xvid_gbl_convert_t convert; |
xvid_gbl_convert_t convert; |
1109 |
|
|