[MPlayer-dev-eng] [PATCH] vf_osd: OSD filter for MPlayer

Michael Niedermayer michaelni at gmx.at
Sun Jul 17 21:59:38 CEST 2005


Hi

On Sunday 17 July 2005 19:16, Jason Tackaberry wrote:
> Hi,
>
> The attached patch implements a filter that provides an OSD buffer to an
> application controlling MPlayer in slave mode.  The features and
> interface is similar to the OSD of the Hauppauge PVR-350 and likely
> other hardware.  Taken from the documentation (included in the patch),
> here is a brief feature overview:
[...]

some comments, not a complete review

> +vf_instance_t** vf_osd = NULL;
> +static struct vf_priv_s **vf_osd_priv = NULL;
> +static mp_image_t *last_mpi = NULL;
> +static int pause_state = 0, num_instances = 0;
> +
> +// Keep track of last update timestamp; we update the overlay up to about 
> +// 30 times a second. 
> +static double last_update_time = 0.0;

non constant statics/globals


> +fprintf(stderr, "@@@ INIT OSD: %d %d\n", width, height);

mp_msg()


> +/* Do colorspace conversion.  It might be nice to use SwScaler here 
instead,

yes


> +   except SwScaler doesn't seem to support converting only specific 
regions.

the swscaler will happily convert any rectangular region you want


> +   And we'd need to do a second pass for alpha anyway.

you could extend the swscaler to support RGBA->YUVA


> +#ifndef HAVE_MMX
> +	int i;
> +	for (i = 0; i < 8; i++)
> +		premultiply_alpha_byte(*(byte++), *(alpha++), dst_byte++, dst_alpha++, 
global_alpha);
> +#else
> +	static int64_t round = { 0x0080008000800080ULL };

mmx should be detected at runtime if its easy and wont cause a slowdown


> +		"emms\n\t"

ehm, uhm, you dont want to do that in the innerost loop, its sloooow on some 
cpus


> +                                     "add $8, %0\n\t"
> +					"add $8, %1\n\t"
> +					"add $8, %2\n\t"
> +					"add $8, %3\n\t"
> +					"decl %%ecx\n\t"
> +					"jnz 1b \n\t"
> +			
> +				:: "r" (dst),
> +				   "r" (src),
> +				   "r" (osd),
> +				   "r" (alpha),
> +				   "m" (c) : "%ecx", "memory"
> +				);

input operands may not be changed

[...]
-- 
Michael




More information about the MPlayer-dev-eng mailing list