+static void remap_packed16(RemapContext *s, const AVFrame *in,
+ const AVFrame *xin, const AVFrame *yin,
+ AVFrame *out)
+{
+ uint16_t *dst = (uint16_t *)out->data[0];
+ const uint16_t *src = (const uint16_t *)in->data[0];
+ const int dlinesize = out->linesize[0] / 2;
+ const int slinesize = in->linesize[0] / 2;
+ const int xlinesize = xin->linesize[0] / 2;
+ const int ylinesize = yin->linesize[0] / 2;
+ const uint16_t *xmap = (const uint16_t *)xin->data[0];
+ const uint16_t *ymap = (const uint16_t *)yin->data[0];
+ const int step = s->step / 2;
+ int c, x, y;
+
+ for (y = 0; y < out->height; y++) {
+ for (x = 0; x < out->width; x++) {
+ for (c = 0; c < s->nb_components; c++) {
+ if (ymap[x] < in->height && xmap[x] < in->width) {
+ dst[x * step + c] = src[ymap[x] * slinesize + xmap[x] * step + c];
+ } else {
+ dst[x * step + c] = 0;
+ }
+ }
+ }
+ dst += dlinesize;
+ xmap += xlinesize;
+ ymap += ylinesize;
+ }
+}
+