- unique_ptr<uint8_t[]> y(new uint8_t[1280 * 720]);
- unique_ptr<uint8_t[]> cb_or_cr(new uint8_t[640 * 720]);
- memset(y.get(), 16, 1280 * 720);
- memset(cb_or_cr.get(), 128, 640 * 720);
- last_frame = encode_jpeg(y.get(), cb_or_cr.get(), cb_or_cr.get(), 1280, 720);
+ unique_ptr<uint8_t[]> y(new uint8_t[global_flags.width * global_flags.height]);
+ unique_ptr<uint8_t[]> cb_or_cr(new uint8_t[(global_flags.width / 2) * global_flags.height]);
+ memset(y.get(), 16, global_flags.width * global_flags.height);
+ memset(cb_or_cr.get(), 128, (global_flags.width / 2) * global_flags.height);
+ last_frame = encode_jpeg(y.get(), cb_or_cr.get(), cb_or_cr.get(), global_flags.width, global_flags.height);