- {
- float *npix = (float*)memalign(16, sstride1 * dst->h1 * sizeof(float));
- vscale(src->data_cr, npix, sstride1, src->h1, dst->h1, sstride1, scaling_filter);
- dst->data_cr = (unsigned char *)malloc(dst->h1 * dstride1);
- hscale(npix, dst->data_cr, src->w1, dst->h1, dst->w1, sstride1, dstride1, scaling_filter);
- free(npix);
- }
- {
- float *npix = (float*)memalign(16, sstride2 * dst->h2 * sizeof(float));
- vscale(src->data_cb, npix, sstride2, src->h2, dst->h2, sstride2, scaling_filter);
- dst->data_cb = (unsigned char *)malloc(dst->h2 * dstride2);
- hscale(npix, dst->data_cb, src->w2, dst->h2, dst->w2, sstride2, dstride2, scaling_filter);
- free(npix);
+ if (src->num_components == 3) {
+ {
+ float *npix = (float*)memalign(16, sstride1 * dst->h1 * sizeof(float));
+ vscale(src->data_cr, npix, sstride1, src->h1, dst->h1, sstride1, scaling_filter);
+ dst->data_cr = (unsigned char *)malloc(dst->h1 * dstride1);
+ hscale(npix, dst->data_cr, src->w1, dst->h1, dst->w1, sstride1, dstride1, scaling_filter);
+ free(npix);
+ }
+ {
+ float *npix = (float*)memalign(16, sstride2 * dst->h2 * sizeof(float));
+ vscale(src->data_cb, npix, sstride2, src->h2, dst->h2, sstride2, scaling_filter);
+ dst->data_cb = (unsigned char *)malloc(dst->h2 * dstride2);
+ hscale(npix, dst->data_cb, src->w2, dst->h2, dst->w2, sstride2, dstride2, scaling_filter);
+ free(npix);
+ }