Revision 6742d95d

View differences:

libavcodec/imgconvert.c
245 245
    }
246 246
}
247 247

  
248
/* 1x1 -> 2x2 */
249
static void grow22(UINT8 *dst, int dst_wrap,
250
                     UINT8 *src, int src_wrap,
251
                     int width, int height)
252
{
253
    int w;
254
    UINT8 *s1, *d;
255

  
256
    for(;height > 0; height--) {
257
        s1 = src;
258
        d = dst;
259
        for(w = width;w >= 4; w-=4) {
260
            d[1] = d[0] = s1[0];
261
            d[3] = d[2] = s1[1];
262
            s1 += 2;
263
            d += 4;
264
        }
265
        for(;w > 0; w--) {
266
            d[0] = s1[0];
267
            s1 ++;
268
            d++;
269
        }
270
        if (height%2)
271
            src += src_wrap;
272
        dst += dst_wrap;
273
    }
274
}
275

  
248 276
static void img_copy(UINT8 *dst, int dst_wrap, 
249 277
                     UINT8 *src, int src_wrap,
250 278
                     int width, int height)
......
382 410
    } else if (dst_pix_fmt == PIX_FMT_YUV420P) {
383 411
        
384 412
        switch(pix_fmt) {
413
        case PIX_FMT_YUV410P:
414
            img_copy(dst->data[0], dst->linesize[0],
415
                     src->data[0], src->linesize[0],
416
                     width, height);
417
            grow22(dst->data[1], dst->linesize[1],
418
                     src->data[1], src->linesize[1],
419
                     width/2, height/2);
420
            grow22(dst->data[2], dst->linesize[2],
421
                     src->data[2], src->linesize[2],
422
                     width/2, height/2);
423
            break;
385 424
        case PIX_FMT_YUV420P:
386 425
            for(i=0;i<3;i++) {
387 426
                img_copy(dst->data[i], dst->linesize[i],

Also available in: Unified diff