Revision 6d93f194 libavcodec/imgconvert.c

View differences:

libavcodec/imgconvert.c
119 119
    /* paletted formats */
120 120
    [PIX_FMT_PAL8] = {
121 121
        .name = "pal8",
122
        .nb_components = 1, .is_packed = 1, .is_paletted = 1,
122
        .nb_components = 1, .is_packed = 1, .is_alpha = 1, .is_paletted = 1,
123 123
    },
124 124
};
125 125

  
......
989 989

  
990 990
    d = dst->data[0];
991 991
    dst_wrap = dst->linesize[0] - ((width + 7) >> 3);
992
    printf("%d %d\n", width, height);
993 992

  
994 993
    for(y=0;y<height;y++) {
995 994
        n = width;
......
1085 1084
        pal[i++] = 0;
1086 1085
}
1087 1086
        
1087
static void rgba32_to_rgb24(AVPicture *dst, AVPicture *src,
1088
                            int width, int height)
1089
{
1090
    const uint8_t *s;
1091
    uint8_t *d;
1092
    int src_wrap, dst_wrap, j, y;
1093
    unsigned int v;
1094

  
1095
    s = src->data[0];
1096
    src_wrap = src->linesize[0] - width * 4;
1097

  
1098
    d = dst->data[0];
1099
    dst_wrap = dst->linesize[0] - width * 3;
1100

  
1101
    for(y=0;y<height;y++) {
1102
        for(j = 0;j < width; j++) {
1103
            v = *(uint32_t *)s;
1104
            s += 4;
1105
            d[0] = v >> 16;
1106
            d[1] = v >> 8;
1107
            d[2] = v;
1108
            d += 3;
1109
        }
1110
        s += src_wrap;
1111
        d += dst_wrap;
1112
    }
1113
}
1114

  
1088 1115
typedef struct ConvertEntry {
1089 1116
    void (*convert)(AVPicture *dst, AVPicture *src, int width, int height);
1090 1117
} ConvertEntry;
......
1158 1185
        [PIX_FMT_GRAY8] = { 
1159 1186
            .convert = rgba32_to_gray
1160 1187
        },
1188
        [PIX_FMT_RGB24] = { 
1189
            .convert = rgba32_to_rgb24
1190
        },
1161 1191
    },
1162 1192
    [PIX_FMT_BGR24] = {
1163 1193
        [PIX_FMT_YUV420P] = { 

Also available in: Unified diff