| 1688 | }; |
| 1689 | |
| 1690 | void* postProcessFrame(void *i) { |
| 1691 | //int tid = *((int *) i); |
| 1692 | Frame frame; |
| 1693 | |
| 1694 | while(1) { |
| 1695 | ROS_INFO_STREAM_COND(DEBUG > 1, "PSTPROC: Wait"); |
| 1696 | std::unique_lock<std::mutex> lk(global.output_queue_mutex); |
| 1697 | global.output_queue_cond.wait(lk, [](){return |
| 1698 | global.output_queue.size() > 0;}); |
| 1699 | ROS_INFO_STREAM_COND(DEBUG > 1, "PSTPROC: Gooo"); |
| 1700 | if (global.quit_threads or !ros::ok()) |
| 1701 | break; |
| 1702 | frame = global.output_queue.pop(); |
| 1703 | frame.postprocesse_begin_time = get_wall_time(); |
| 1704 | |
| 1705 | //Mat visualize(NET_RESOLUTION_HEIGHT, NET_RESOLUTION_WIDTH, CV_8UC3); |
| 1706 | |
| 1707 | int offset = DISPLAY_RESOLUTION_WIDTH * DISPLAY_RESOLUTION_HEIGHT; |
| 1708 | for(int c = 0; c < 3 and not (global.quit_threads or not ros::ok()); c++) { |
| 1709 | for(int i = 0; i < DISPLAY_RESOLUTION_HEIGHT and not |
| 1710 | (global.quit_threads or not ros::ok()); i++) { |
| 1711 | for(int j = 0; j < DISPLAY_RESOLUTION_WIDTH and not |
| 1712 | (global.quit_threads or not ros::ok()); j++) { |
| 1713 | int value = |
| 1714 | int(frame.data_for_mat[c*offset + i*DISPLAY_RESOLUTION_WIDTH + j] |
| 1715 | + 0.5); |
| 1716 | value = value<0 ? 0 : (value > 255 ? 255 : value); |
| 1717 | frame.data_for_wrap[3*(i*DISPLAY_RESOLUTION_WIDTH + j) + c] = |
| 1718 | (unsigned char)(value); |
| 1719 | } |
| 1720 | } |
| 1721 | } |
| 1722 | frame.postprocesse_end_time = get_wall_time(); |
| 1723 | global.output_queue_mated.push(frame); |
| 1724 | ROS_INFO_STREAM_COND(DEBUG > 1, "PSTPROC: Notify BFRORDER"); |
| 1725 | global.output_queue_mated_cond.notify_one(); |
| 1726 | } |
| 1727 | return nullptr; |
| 1728 | } |
| 1729 | |
| 1730 | void* buffer_and_order(void* threadargs) { //only one thread can execute this |
| 1731 | FrameCompare comp; |
nothing calls this directly
no test coverage detected