~ubuntu-branches/ubuntu/trusty/libav/trusty-proposed

« back to all changes in this revision

Viewing changes to libavfilter/drawutils.c

  • Committer: Package Import Robot
  • Author(s): Reinhard Tartler
  • Date: 2013-10-22 23:24:08 UTC
  • mfrom: (1.3.36 sid)
  • Revision ID: package-import@ubuntu.com-20131022232408-b8tvvn4pyzri9mi3
Tags: 6:9.10-1ubuntu1
* Build all -extra flavors from this source package, as libav got demoted
  from main to universe, cf LP: #1243235
* Simplify debian/rules to follow exactly the code that debian executes
* New upstream (LP: #1180288) fixes lots of security issues (LP: #1242802)
* Merge from unstable, remaining changes:
  - build-depend on libtiff5-dev rather than libtiff4-dev,
    avoids FTBFS caused by imlib
  - follow the regular debian codepaths

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
17
 */
18
18
 
 
19
#include <string.h>
 
20
 
19
21
#include "libavutil/avutil.h"
20
22
#include "libavutil/colorspace.h"
 
23
#include "libavutil/mem.h"
21
24
#include "libavutil/pixdesc.h"
22
25
#include "drawutils.h"
23
26
 
24
27
enum { RED = 0, GREEN, BLUE, ALPHA };
25
28
 
26
29
int ff_fill_line_with_color(uint8_t *line[4], int pixel_step[4], int w, uint8_t dst_color[4],
27
 
                            enum PixelFormat pix_fmt, uint8_t rgba_color[4],
 
30
                            enum AVPixelFormat pix_fmt, uint8_t rgba_color[4],
28
31
                            int *is_packed_rgba, uint8_t rgba_map_ptr[4])
29
32
{
30
33
    uint8_t rgba_map[4] = {0};
31
34
    int i;
32
 
    const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[pix_fmt];
 
35
    const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(pix_fmt);
33
36
    int hsub = pix_desc->log2_chroma_w;
34
37
 
35
38
    *is_packed_rgba = 1;
36
39
    switch (pix_fmt) {
37
 
    case PIX_FMT_ARGB:  rgba_map[ALPHA] = 0; rgba_map[RED  ] = 1; rgba_map[GREEN] = 2; rgba_map[BLUE ] = 3; break;
38
 
    case PIX_FMT_ABGR:  rgba_map[ALPHA] = 0; rgba_map[BLUE ] = 1; rgba_map[GREEN] = 2; rgba_map[RED  ] = 3; break;
39
 
    case PIX_FMT_RGBA:
40
 
    case PIX_FMT_RGB24: rgba_map[RED  ] = 0; rgba_map[GREEN] = 1; rgba_map[BLUE ] = 2; rgba_map[ALPHA] = 3; break;
41
 
    case PIX_FMT_BGRA:
42
 
    case PIX_FMT_BGR24: rgba_map[BLUE ] = 0; rgba_map[GREEN] = 1; rgba_map[RED  ] = 2; rgba_map[ALPHA] = 3; break;
 
40
    case AV_PIX_FMT_ARGB:  rgba_map[ALPHA] = 0; rgba_map[RED  ] = 1; rgba_map[GREEN] = 2; rgba_map[BLUE ] = 3; break;
 
41
    case AV_PIX_FMT_ABGR:  rgba_map[ALPHA] = 0; rgba_map[BLUE ] = 1; rgba_map[GREEN] = 2; rgba_map[RED  ] = 3; break;
 
42
    case AV_PIX_FMT_RGBA:
 
43
    case AV_PIX_FMT_RGB24: rgba_map[RED  ] = 0; rgba_map[GREEN] = 1; rgba_map[BLUE ] = 2; rgba_map[ALPHA] = 3; break;
 
44
    case AV_PIX_FMT_BGRA:
 
45
    case AV_PIX_FMT_BGR24: rgba_map[BLUE ] = 0; rgba_map[GREEN] = 1; rgba_map[RED  ] = 2; rgba_map[ALPHA] = 3; break;
43
46
    default:
44
47
        *is_packed_rgba = 0;
45
48
    }