void inv_test (int filter, int width, int height) { int i; SchroFrame *test; SchroFrame *orig; SchroFrame *ref; SchroFrameData *fd_test; SchroFrameData *fd_orig; SchroFrameData *fd_ref; char name[TEST_PATTERN_NAME_SIZE] = { 0 }; orig = schro_frame_new_and_alloc (NULL, SCHRO_FRAME_FORMAT_S16_444, width, height); fd_orig = orig->components + 0; test = schro_frame_new_and_alloc (NULL, SCHRO_FRAME_FORMAT_S16_444, width, height); fd_test = test->components + 0; ref = schro_frame_new_and_alloc (NULL, SCHRO_FRAME_FORMAT_S16_444, width, height); fd_ref = ref->components + 0; for(i=0;i<test_pattern_get_n_generators();i++){ test_pattern_generate (fd_orig, name, i); printf(" reverse test \"%s\":\n", name); fflush(stdout); iwt_ref(fd_orig,filter); schro_frame_convert (test, orig); schro_frame_convert (ref, orig); iiwt_ref(fd_ref,filter); iiwt_test(fd_test,filter); if (!frame_data_compare(fd_test, fd_ref)) { printf(" failed\n"); if (verbose) frame_data_dump_full (fd_test, fd_ref, fd_orig); fail = TRUE; } } schro_frame_unref (orig); schro_frame_unref (test); schro_frame_unref (ref); }
void fwd_random_test_s32 (int filter, int width, int height) { SchroFrame *test; SchroFrame *orig; SchroFrame *ref; SchroFrameData *fd_orig; SchroFrameData *fd_test; SchroFrameData *fd_ref; char name[TEST_PATTERN_NAME_SIZE] = { 0 }; orig = schro_frame_new_and_alloc (NULL, SCHRO_FRAME_FORMAT_S16_444, width, height); fd_orig = orig->components + 0; test = schro_frame_new_and_alloc (NULL, SCHRO_FRAME_FORMAT_S32_444, width, height); fd_test = test->components + 0; ref = schro_frame_new_and_alloc (NULL, SCHRO_FRAME_FORMAT_S16_444, width, height); fd_ref = ref->components + 0; test_pattern_generate (fd_orig, name, 0); printf(" forward test 32-bit \"%s\":\n", name); fflush(stdout); schro_frame_convert (ref, orig); schro_frame_convert (test, orig); iwt_ref(fd_ref,filter); iwt_test(fd_test,filter); if (!frame_data_compare(fd_test, fd_ref)) { printf(" failed\n"); if (verbose) frame_data_dump_full (fd_test, fd_ref, fd_orig); fail = TRUE; } schro_frame_unref (orig); schro_frame_unref (test); schro_frame_unref (ref); }
bool PacketListModel::recordLessThan(PacketListRecord *r1, PacketListRecord *r2) { int cmp_val = 0; // Wherein we try to cram the logic of packet_list_compare_records, // _packet_list_compare_records, and packet_list_compare_custom from // gtk/packet_list_store.c into one function if (sort_column_ < 0) { // No column. cmp_val = frame_data_compare(sort_cap_file_->epan, r1->frameData(), r2->frameData(), COL_NUMBER); } else if (text_sort_column_ < 0) { // Column comes directly from frame data cmp_val = frame_data_compare(sort_cap_file_->epan, r1->frameData(), r2->frameData(), sort_cap_file_->cinfo.col_fmt[sort_column_]); } else { if (r1->columnString(sort_cap_file_, sort_column_).toByteArray().data() == r2->columnString(sort_cap_file_, sort_column_).toByteArray().data()) { cmp_val = 0; } else if (sort_cap_file_->cinfo.col_fmt[sort_column_] == COL_CUSTOM) { header_field_info *hfi; // Column comes from custom data hfi = proto_registrar_get_byname(sort_cap_file_->cinfo.col_custom_field[sort_column_]); if (hfi == NULL) { cmp_val = frame_data_compare(sort_cap_file_->epan, r1->frameData(), r2->frameData(), COL_NUMBER); } else if ((hfi->strings == NULL) && (((IS_FT_INT(hfi->type) || IS_FT_UINT(hfi->type)) && ((hfi->display == BASE_DEC) || (hfi->display == BASE_DEC_HEX) || (hfi->display == BASE_OCT))) || (hfi->type == FT_DOUBLE) || (hfi->type == FT_FLOAT) || (hfi->type == FT_BOOLEAN) || (hfi->type == FT_FRAMENUM) || (hfi->type == FT_RELATIVE_TIME))) { /* Attempt to convert to numbers */ bool ok_r1, ok_r2; double num_r1 = r1->columnString(sort_cap_file_, sort_column_).toDouble(&ok_r1); double num_r2 = r2->columnString(sort_cap_file_, sort_column_).toDouble(&ok_r2); if (!ok_r1 && !ok_r2) { cmp_val = 0; } else if (!ok_r1 || num_r1 < num_r2) { cmp_val = -1; } else if (!ok_r2 || num_r1 > num_r2) { cmp_val = 1; } } else { cmp_val = strcmp(r1->columnString(sort_cap_file_, sort_column_).toByteArray().data(), r2->columnString(sort_cap_file_, sort_column_).toByteArray().data()); } } else { cmp_val = strcmp(r1->columnString(sort_cap_file_, sort_column_).toByteArray().data(), r2->columnString(sort_cap_file_, sort_column_).toByteArray().data()); } if (cmp_val == 0) { // Last resort. Compare column numbers. cmp_val = frame_data_compare(sort_cap_file_->epan, r1->frameData(), r2->frameData(), COL_NUMBER); } } if (sort_order_ == Qt::AscendingOrder) { return cmp_val < 0; } else { return cmp_val > 0; } }