- int *coefficients;
- const int *new_coefficients;
- int full_range;
- int brightness, contrast, saturation;
-
- if ( sws_getColorspaceDetails( context, &coefficients, &full_range, &coefficients, &full_range,
- &brightness, &contrast, &saturation ) != -1 )
- {
- // Don't change these from defaults unless explicitly told to.
- if ( use_full_range >= 0 )
- full_range = use_full_range;
- switch ( colorspace )
- {
- case 170:
- case 470:
- case 601:
- case 624:
- new_coefficients = sws_getCoefficients( SWS_CS_ITU601 );
- break;
- case 240:
- new_coefficients = sws_getCoefficients( SWS_CS_SMPTE240M );
- break;
- case 709:
- new_coefficients = sws_getCoefficients( SWS_CS_ITU709 );
- break;
- default:
- new_coefficients = coefficients;
- break;
- }
- sws_setColorspaceDetails( context, new_coefficients, full_range, new_coefficients, full_range,
- brightness, contrast, saturation );
+ const int *src_coefficients = sws_getCoefficients( SWS_CS_DEFAULT );
+ const int *dst_coefficients = sws_getCoefficients( SWS_CS_DEFAULT );
+ int brightness = 0;
+ int contrast = 1 << 16;
+ int saturation = 1 << 16;
+
+ switch ( src_colorspace )
+ {
+ case 170:
+ case 470:
+ case 601:
+ case 624:
+ src_coefficients = sws_getCoefficients( SWS_CS_ITU601 );
+ break;
+ case 240:
+ src_coefficients = sws_getCoefficients( SWS_CS_SMPTE240M );
+ break;
+ case 709:
+ src_coefficients = sws_getCoefficients( SWS_CS_ITU709 );
+ break;
+ default:
+ break;
+ }
+ switch ( dst_colorspace )
+ {
+ case 170:
+ case 470:
+ case 601:
+ case 624:
+ src_coefficients = sws_getCoefficients( SWS_CS_ITU601 );
+ break;
+ case 240:
+ src_coefficients = sws_getCoefficients( SWS_CS_SMPTE240M );
+ break;
+ case 709:
+ src_coefficients = sws_getCoefficients( SWS_CS_ITU709 );
+ break;
+ default:
+ break;