+static subpicture_region_private_t *SpuRegionPrivateNew( video_format_t * );
+static void SpuRegionPrivateDelete( subpicture_region_private_t * );
+
+/* */
+typedef struct
+{
+ int w;
+ int h;
+} spu_scale_t;
+static spu_scale_t spu_scale_create( int w, int h );
+static spu_scale_t spu_scale_unit(void );
+static spu_scale_t spu_scale_createq( int wn, int wd, int hn, int hd );
+static int spu_scale_w( int v, const spu_scale_t s );
+static int spu_scale_h( int v, const spu_scale_t s );
+static int spu_invscale_w( int v, const spu_scale_t s );
+static int spu_invscale_h( int v, const spu_scale_t s );
+
+typedef struct
+{
+ int i_x;
+ int i_y;
+ int i_width;
+ int i_height;
+
+ spu_scale_t scale;
+} spu_area_t;
+
+static spu_area_t spu_area_create( int x, int y, int w, int h, spu_scale_t );
+static spu_area_t spu_area_scaled( spu_area_t );
+static spu_area_t spu_area_unscaled( spu_area_t, spu_scale_t );
+static bool spu_area_overlap( spu_area_t, spu_area_t );
+
+
+/* Subpicture rendered flag
+ * FIXME ? it could be moved to private ? */
+#define SUBPICTURE_RENDERED (0x1000)
+#if SUBPICTURE_RENDERED < SUBPICTURE_ALIGN_MASK
+# error SUBPICTURE_RENDERED too low
+#endif
+
+#define SCALE_UNIT (1000)
+
+static void SubpictureChain( subpicture_t **pp_head, subpicture_t *p_subpic );
+static int SubpictureCmp( const void *s0, const void *s1 );
+
+static void SpuRenderRegion( spu_t *,
+ picture_t *p_pic_dst, spu_area_t *,
+ subpicture_t *, subpicture_region_t *,
+ const spu_scale_t scale_size,
+ const video_format_t *p_fmt,
+ const spu_area_t *p_subtitle_area, int i_subtitle_area );