    }
  }
  
  bool FrameReader::copyBuffers(AVFrame *f, uint8_t *rgb, uint8_t *yuv) {
    if (hw_pix_fmt == AV_PIX_FMT_CUDA) {
      uint8_t *y = yuv ? yuv : nv12toyuv_buffer.data();
      uint8_t *u = y + width * height;
      uint8_t *v = u + (width / 2) * (height / 2);
      libyuv::NV12ToI420(f->data[0], f->linesize[0], f->data[1], f->linesize[1],
                         y, width, u, width / 2, v, width / 2, width, height);
 
</s> remove   bool load(const std::string &url, bool no_cuda = false, std::atomic<bool> *abort = nullptr, bool local_cache = false, int chunk_size = -1, int retries = 0);
  bool load(const std::byte *data, size_t size, bool no_cuda = false, std::atomic<bool> *abort = nullptr);
 </s> add   bool load(const std::string &url, bool no_hw_decoder = false, std::atomic<bool> *abort = nullptr, bool local_cache = false, int chunk_size = -1, int retries = 0);
  bool load(const std::byte *data, size_t size, bool no_hw_decoder = false, std::atomic<bool> *abort = nullptr); </s> remove   if (has_cuda_device && !no_cuda) {
    if (!initHardwareDecoder(AV_HWDEVICE_TYPE_CUDA)) {
      rWarning("No CUDA capable device was found. fallback to CPU decoding.");
 </s> add   if (has_hw_decoder && !no_hw_decoder) {
    if (!initHardwareDecoder(HW_DEVICE_TYPE)) {
      rWarning("No device with hardware decoder found. fallback to CPU decoding."); </s> remove     success = frames[id]->load(file, flags & REPLAY_FLAG_NO_CUDA, &abort_, local_cache, 20 * 1024 * 1024, 3);
 </s> add     success = frames[id]->load(file, flags & REPLAY_FLAG_NO_HW_DECODER, &abort_, local_cache, 20 * 1024 * 1024, 3); </s> remove   rWarning("Please run replay with the --no-cuda flag!");
 </s> add   rWarning("Please run replay with the --no-hw-decoder flag!");
  if (hw_pix_fmt == HW_PIX_FMT) {
    }
  }
  
  bool FrameReader::copyBuffers(AVFrame *f, uint8_t *rgb, uint8_t *yuv) {
  if (hw_pix_fmt == HW_PIX_FMT) {
      uint8_t *y = yuv ? yuv : nv12toyuv_buffer.data();
      uint8_t *u = y + width * height;
      uint8_t *v = u + (width / 2) * (height / 2);
      libyuv::NV12ToI420(f->data[0], f->linesize[0], f->data[1], f->linesize[1],
                         y, width, u, width / 2, v, width / 2, width, height);
keep keep keep keep replace keep keep keep keep keep
 replay: use VideoToolbox HW decoder on Mac (#23832)

* replay: support VideoToolbox HW decoding

* rename flag

* remove debug assert 
selfdrive/ui/replay/framereader.cc