/* * Copyright (c) 2018, Alliance for Open Media. All rights reserved. * * This source code is subject to the terms of the BSD 2 Clause License and * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License * was not distributed with this source code in the LICENSE file, you can * obtain it at www.aomedia.org/license/software. If the Alliance for Open * Media Patent License 1.0 was not distributed with this source code in the * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
staticint scan_test(const int16_t *scan, const int16_t *iscan, int si, int r, int c, int h) { if (iscan[c * h + r] != si || scan[si] != c * h + r) {
printf("r %d c %d ref_iscan %d iscan %d ref_scan %d scan %d\n", r, c, si,
iscan[c * h + r], c * h + r, scan[si]); return 1;
} else { return 0;
}
}
staticint scan_order_test(const SCAN_ORDER *scan_order, int w, int h,
SCAN_MODE mode) { const int16_t *scan = scan_order->scan; const int16_t *iscan = scan_order->iscan; int dim = w + h - 1; if (mode == SCAN_MODE_ZIG_ZAG) { int si = 0; for (int i = 0; i < dim; ++i) { if (i % 2 == 0) { for (int c = 0; c < w; ++c) { int r = i - c; if (r >= 0 && r < h) { if (scan_test(scan, iscan, si, r, c, h)) return 1;
++si;
}
}
} else { for (int r = 0; r < h; ++r) { int c = i - r; if (c >= 0 && c < w) { if (scan_test(scan, iscan, si, r, c, h)) return 1;
++si;
}
}
}
}
} elseif (mode == SCAN_MODE_COL_DIAG) { int si = 0; for (int i = 0; i < dim; ++i) { for (int c = 0; c < w; ++c) { int r = i - c; if (r >= 0 && r < h) { if (scan_test(scan, iscan, si, r, c, h)) return 1;
++si;
}
}
}
} elseif (mode == SCAN_MODE_ROW_DIAG) { int si = 0; for (int i = 0; i < dim; ++i) { for (int r = 0; r < h; ++r) { int c = i - r; if (c >= 0 && c < w) { if (scan_test(scan, iscan, si, r, c, h)) return 1;
++si;
}
}
}
} elseif (mode == SCAN_MODE_ROW_1D) { int si = 0; for (int r = 0; r < h; ++r) { for (int c = 0; c < w; ++c) { if (scan_test(scan, iscan, si, r, c, h)) return 1;
++si;
}
}
} else {
assert(mode == SCAN_MODE_COL_1D); int si = 0; for (int c = 0; c < w; ++c) { for (int r = 0; r < h; ++r) { if (scan_test(scan, iscan, si, r, c, h)) return 1;
++si;
}
}
} return 0;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.