[MPlayer-dev-eng] [PATCH] ASS subtitle speedup (take 2)

Evgeniy Stepanov eugeni.stepanov at gmail.com
Sat Dec 2 20:31:56 CET 2006


On Saturday 02 December 2006 21:35, Reimar Döffinger wrote:
> Hello,
>
> On Sat, Dec 02, 2006 at 09:21:23PM +0300, Evgeniy Stepanov wrote:
> > Index: libvo/vo_gl.c
> > ===================================================================
> > --- libvo/vo_gl.c	(revision 21443)
> > +++ libvo/vo_gl.c	(working copy)
>
> I did not review the other parts..
>
> > -static void genEOSD(ass_image_t *img) {
> > +static void genEOSD(mp_eosd_images_t *imgs) {
> >    int sx, sy;
> >    int tinytexcur = 0;
> >    int smalltexcur = 0;
> >    GLuint *curtex;
> >    GLint scale_type = (scaled_osd) ? GL_LINEAR : GL_NEAREST;
> > +  ass_image_t *img;
> >    ass_image_t *i;
> >    int cnt;
> > +
> > +  if (!imgs || !imgs->imgs) {
> > +      // clear the displayed elements, if any
> > +      if (eosdtexCnt || eosdDispList)
> > +          clearEOSD();
> > +      return;
> > +  }
> > +
> > +  if (imgs->changed == 0)
> > +      // there are elements, but they are unchanged
> > +      return;
> > +
> > +  // normal processing
> > +
> > +  img = imgs->imgs;
> > +
> > +  if (imgs->changed == 1)
> > +      // there are elements, but they just moved
> > +      goto skip_upload;
> > +
>
> Should be simplified:
> ass_image_t *img = NULL;
> [...]
> if (imgs) {
>   img = imgs->imgs;
>   if (!imgs->changed) // OSD has not changed
>     return;
>   if (img && imgs->changed == 1) // only positions of OSD parts have
> changed goto skip_upload;
> }

I think it's better to check for non-zero data in VOCTRL switch and ignore 
such requests. This should not normally happen.

> Though I wonder if/how the imgs->imgs == NULL && imgs->changed == 1 case
> should be handled (your code probably would crash?).

Why should it ? imgs->imgs == NULL is nothing special, just a list of zero 
elements.



More information about the MPlayer-dev-eng mailing list