@@ -185,17 +185,18 @@ void initializeContextOnCuda(
185185
186186void convertAVFrameToDecodedOutputOnCuda (
187187 const torch::Device& device,
188- const VideoDecoder::VideoStreamDecoderOptions& options ,
188+ const VideoDecoder::VideoStreamOptions& videoStreamOptions ,
189189 VideoDecoder::RawDecodedOutput& rawOutput,
190190 VideoDecoder::DecodedOutput& output,
191191 std::optional<torch::Tensor> preAllocatedOutputTensor) {
192- AVFrame* src = rawOutput.frame .get ();
192+ AVFrame* avFrame = rawOutput.avFrame .get ();
193193
194194 TORCH_CHECK (
195- src ->format == AV_PIX_FMT_CUDA,
195+ avFrame ->format == AV_PIX_FMT_CUDA,
196196 " Expected format to be AV_PIX_FMT_CUDA, got " +
197- std::string (av_get_pix_fmt_name ((AVPixelFormat)src->format )));
198- auto frameDims = getHeightAndWidthFromOptionsOrAVFrame (options, *src);
197+ std::string (av_get_pix_fmt_name ((AVPixelFormat)avFrame->format )));
198+ auto frameDims =
199+ getHeightAndWidthFromOptionsOrAVFrame (videoStreamOptions, *avFrame);
199200 int height = frameDims.height ;
200201 int width = frameDims.width ;
201202 torch::Tensor& dst = output.frame ;
@@ -212,28 +213,28 @@ void convertAVFrameToDecodedOutputOnCuda(
212213 " x3, got " ,
213214 shape);
214215 } else {
215- dst = allocateEmptyHWCTensor (height, width, options .device );
216+ dst = allocateEmptyHWCTensor (height, width, videoStreamOptions .device );
216217 }
217218
218219 // Use the user-requested GPU for running the NPP kernel.
219220 c10::cuda::CUDAGuard deviceGuard (device);
220221
221222 NppiSize oSizeROI = {width, height};
222- Npp8u* input[2 ] = {src ->data [0 ], src ->data [1 ]};
223+ Npp8u* input[2 ] = {avFrame ->data [0 ], avFrame ->data [1 ]};
223224
224225 auto start = std::chrono::high_resolution_clock::now ();
225226 NppStatus status;
226- if (src ->colorspace == AVColorSpace::AVCOL_SPC_BT709) {
227+ if (avFrame ->colorspace == AVColorSpace::AVCOL_SPC_BT709) {
227228 status = nppiNV12ToRGB_709CSC_8u_P2C3R (
228229 input,
229- src ->linesize [0 ],
230+ avFrame ->linesize [0 ],
230231 static_cast <Npp8u*>(dst.data_ptr ()),
231232 dst.stride (0 ),
232233 oSizeROI);
233234 } else {
234235 status = nppiNV12ToRGB_8u_P2C3R (
235236 input,
236- src ->linesize [0 ],
237+ avFrame ->linesize [0 ],
237238 static_cast <Npp8u*>(dst.data_ptr ()),
238239 dst.stride (0 ),
239240 oSizeROI);
0 commit comments