int main(int argc, char **argv) { if (argc > 1 && strcmp(argv[1], "-n") == 0) { cpu_force_no_simd( ); } /* Read 540p frames on stdin; dump 1080p frames on stdout... */ RawFrame frame(960, 540, RawFrame::CbYCrY8422); ssize_t ret; for (;;) { ret = frame.read_from_fd(STDIN_FILENO); if (ret < 0) { perror("frame.read_from_fd"); exit(1); } else if (ret == 0) { break; } else { RawFrame *out = frame.convert->CbYCrY8422_scan_double( ); if (out->write_to_fd(STDOUT_FILENO) < 0) { perror("write_to_fd"); break; } delete out; } } }
int main( ) { static char svg_buf[MAX_SVG]; ssize_t read_ret; size_t read_pos = 0; /* slurp input */ while (read_pos < MAX_SVG) { read_ret = read(STDIN_FILENO, svg_buf + read_pos, MAX_SVG - read_pos); if (read_ret < 0) { perror("read"); exit(1); } else if (read_ret == 0) { break; } else { read_pos += read_ret; } } /* create SVG frame */ RawFrame *svg = RsvgFrame::render_svg(svg_buf, read_pos); /* dump raw BGRAn8 video to stdout */ fprintf(stderr, "w=%d h=%d\n", svg->w( ), svg->h( )); svg->write_to_fd(STDOUT_FILENO); }
int main(int argc, char **argv) { if (argc > 1 && strcmp(argv[1], "-n") == 0) { cpu_force_no_simd( ); } build_lookup_tables( ); /* Read 1080p UYVY422 frames on stdin. Dump M-JPEG stream on stdout. */ RawFrame frame(720, 480, RawFrame::CbYCrY8422); ssize_t ret; for (;;) { ret = frame.read_from_fd(STDIN_FILENO); if (ret < 0) { perror("frame.read_from_fd"); exit(1); } else if (ret == 0) { break; } else { RawFrame *out = upscale(&frame); if (out->write_to_fd(STDOUT_FILENO) < 0) { perror("write_to_fd"); break; } delete out; } } }
int main(int argc, char **argv) { int n_frames = 1000; if (argc > 1 && strcmp(argv[1], "-n") == 0) { cpu_force_no_simd( ); } RawFrame frame(1920, 1080, RawFrame::CbYCrY8422); ssize_t ret; ret = frame.read_from_fd(STDIN_FILENO); if (ret <= 0) { perror("frame.read_from_fd"); exit(1); } else { while (n_frames != 0) { RawFrame *out = frame.convert->BGRAn8( ); #if 0 if (out->write_to_fd(STDOUT_FILENO) < 0) { perror("write_to_fd"); exit(1); } #endif delete out; n_frames--; } } return 0; }
int main(int argc, char **argv) { if (argc > 1 && strcmp(argv[1], "-n") == 0) { cpu_force_no_simd( ); } /* Read 1080p UYVY422 frames on stdin. Dump M-JPEG stream on stdout. */ RawFrame frame(1920, 1080, RawFrame::CbYCrY8422); Mjpeg422Encoder enc(1920, 1080); Mjpeg422Decoder dec(1920, 1080); ssize_t ret; std::string comment; for (;;) { ret = frame.read_from_fd(STDIN_FILENO); if (ret < 0) { perror("frame.read_from_fd"); exit(1); } else if (ret == 0) { break; } else { enc.set_comment("Hello JPEG world!"); enc.encode(&frame); RawFrame *out = dec.decode(enc.get_data( ), enc.get_data_size( )); comment = " "; dec.get_comment(comment); fprintf(stderr, "comment: %s\n", comment.c_str( )); if (out->write_to_fd(STDOUT_FILENO) < 0) { perror("write_to_fd"); break; } delete out; } } }