summaryrefslogtreecommitdiffstats
path: root/libmpcodecs
diff options
context:
space:
mode:
authormichael <michael@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-02-21 20:35:18 +0000
committermichael <michael@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-02-21 20:35:18 +0000
commit274db98899b16c07e70af7924a1b6933e765126f (patch)
tree18740b054e28a54fe0fcf7ee801fa8ea09022a4b /libmpcodecs
parent62963a2a7c3ad9d3fbabdba0e207d474de4ff1d1 (diff)
downloadmpv-274db98899b16c07e70af7924a1b6933e765126f.tar.bz2
mpv-274db98899b16c07e70af7924a1b6933e765126f.tar.xz
yuv2rgb brightness/contrast/saturation/different colorspaces support finished
yuv2rgb deglobalize yuv2rgb optimizations / cleanup bugs? git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@9477 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs')
-rw-r--r--libmpcodecs/vf_scale.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/libmpcodecs/vf_scale.c b/libmpcodecs/vf_scale.c
index e6f505a62a..5739a0601c 100644
--- a/libmpcodecs/vf_scale.c
+++ b/libmpcodecs/vf_scale.c
@@ -220,6 +220,59 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi){
return vf_next_put_image(vf,dmpi);
}
+static int control(struct vf_instance_s* vf, int request, void* data){
+ int *table;
+ int *inv_table;
+ int r;
+ int brightness, contrast, saturation, srcRange, dstRange;
+ vf_equalizer_t *eq;
+
+ switch(request){
+ case VFCTRL_GET_EQUALIZER:
+ r= sws_getColorspaceDetails(vf->priv->ctx, &inv_table, &srcRange, &table, &dstRange, &brightness, &contrast, &saturation);
+ if(r<0) break;
+
+ eq = data;
+ if (!strcmp(eq->item,"brightness")) {
+ eq->value = ((brightness*100) + (1<<15))>>16;
+ }
+ else if (!strcmp(eq->item,"contrast")) {
+ eq->value = (((contrast *100) + (1<<15))>>16) - 100;
+ }
+ else if (!strcmp(eq->item,"saturation")) {
+ eq->value = (((saturation*100) + (1<<15))>>16) - 100;
+ }
+ else
+ break;
+ return CONTROL_TRUE;
+ case VFCTRL_SET_EQUALIZER:
+ r= sws_getColorspaceDetails(vf->priv->ctx, &inv_table, &srcRange, &table, &dstRange, &brightness, &contrast, &saturation);
+ if(r<0) break;
+//printf("set %f %f %f\n", brightness/(float)(1<<16), contrast/(float)(1<<16), saturation/(float)(1<<16));
+ eq = data;
+
+ if (!strcmp(eq->item,"brightness")) {
+ brightness = (( eq->value <<16) + 50)/100;
+ }
+ else if (!strcmp(eq->item,"contrast")) {
+ contrast = (((eq->value+100)<<16) + 50)/100;
+ }
+ else if (!strcmp(eq->item,"saturation")) {
+ saturation = (((eq->value+100)<<16) + 50)/100;
+ }
+ else
+ break;
+
+ r= sws_setColorspaceDetails(vf->priv->ctx, inv_table, srcRange, table, dstRange, brightness, contrast, saturation);
+ if(r<0) break;
+
+ return CONTROL_TRUE;
+ default:
+ }
+
+ return vf_next_control(vf,request,data);
+}
+
//===========================================================================//
// supported Input formats: YV12, I420, IYUV, YUY2, UYVY, BGR32, BGR24, BGR16, BGR15, RGB32, RGB24, Y8, Y800
@@ -263,6 +316,7 @@ static int open(vf_instance_t *vf, char* args){
vf->config=config;
vf->put_image=put_image;
vf->query_format=query_format;
+ vf->control= control;
vf->priv=malloc(sizeof(struct vf_priv_s));
// TODO: parse args ->
vf->priv->ctx=NULL;