The cirros image was rebuilt against the 3.13.0-83 kernel, drivers e1000e, igbvf...
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / ffmpeg / 0001-Support-raw-dvdsub-palette-as-stored-on-normal-dvd-s.patch
1 From 74f1c9b43b191a9d6b494e90a4a11677fca33c13 Mon Sep 17 00:00:00 2001
2 From: Joakim Plate <elupus@ecce.se>
3 Date: Sun, 11 Sep 2011 19:04:51 +0200
4 Subject: [PATCH 01/13] Support raw dvdsub palette as stored on normal dvd's
5
6 This is how the palette is stored on dvd's. Currently
7 only xbmc passes the palette information to libavcodec
8 this way.
9
10 Patch part of the XBMC patch set for ffmpeg, downloaded from
11 https://github.com/xbmc/FFmpeg/.
12
13 Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
14 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
15 ---
16  libavcodec/dvdsubdec.c | 24 ++++++++++++++++++++++++
17  1 file changed, 24 insertions(+)
18
19 diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c
20 index 39604f3..a711e16 100644
21 --- a/libavcodec/dvdsubdec.c
22 +++ b/libavcodec/dvdsubdec.c
23 @@ -64,6 +64,24 @@ static void yuv_a_to_rgba(const uint8_t *ycbcr, const uint8_t *alpha, uint32_t *
24      }
25  }
26  
27 +static void ayvu_to_argb(const uint8_t *ayvu, uint32_t *argb, int num_values)
28 +{
29 +    uint8_t *cm = ff_crop_tab + MAX_NEG_CROP;
30 +    uint8_t r, g, b;
31 +    int i, y, cb, cr, a;
32 +    int r_add, g_add, b_add;
33 +
34 +    for (i = num_values; i > 0; i--) {
35 +        a = *ayvu++;
36 +        y = *ayvu++;
37 +        cr = *ayvu++;
38 +        cb = *ayvu++;
39 +        YUV_TO_RGB1_CCIR(cb, cr);
40 +        YUV_TO_RGB2_CCIR(r, g, b, y);
41 +        *argb++ = (a << 24) | (r << 16) | (g << 8) | b;
42 +    }
43 +}
44 +
45  static int decode_run_2bit(GetBitContext *gb, int *color)
46  {
47      unsigned int v, t;
48 @@ -697,6 +715,12 @@ static av_cold int dvdsub_init(AVCodecContext *avctx)
49          parse_ifo_palette(ctx, ctx->ifo_str);
50      if (ctx->palette_str)
51          parse_palette(ctx, ctx->palette_str);
52 +
53 +    if (!ctx->has_palette && avctx->extradata_size == 64) {
54 +        ayvu_to_argb((uint8_t*)avctx->extradata, ctx->palette, 16);
55 +        ctx->has_palette = 1;
56 +    }
57 +
58      if (ctx->has_palette) {
59          int i;
60          av_log(avctx, AV_LOG_DEBUG, "palette:");
61 -- 
62 2.1.0
63