@@ -94,6 +94,9 @@ void CpuDeviceInterface::initialize(
9494 if (areTransformsSwScaleCompatible &&
9595 (userRequestedSwScale || isWidthSwScaleCompatible)) {
9696 colorConversionLibrary_ = ColorConversionLibrary::SWSCALE;
97+
98+ // SCOTT NEXT TODO: set swsFlags_
99+
97100 } else {
98101 colorConversionLibrary_ = ColorConversionLibrary::FILTERGRAPH;
99102
@@ -112,6 +115,8 @@ void CpuDeviceInterface::initialize(
112115 filters_ = filters.str ();
113116 }
114117 }
118+
119+ initialized_ = true ;
115120}
116121
117122// Note [preAllocatedOutputTensor with swscale and filtergraph]:
@@ -127,6 +132,7 @@ void CpuDeviceInterface::convertAVFrameToFrameOutput(
127132 UniqueAVFrame& avFrame,
128133 FrameOutput& frameOutput,
129134 std::optional<torch::Tensor> preAllocatedOutputTensor) {
135+ TORCH_CHECK (initialized_, " CpuDeviceInterface was not initialized." );
130136 if (preAllocatedOutputTensor.has_value ()) {
131137 auto shape = preAllocatedOutputTensor.value ().sizes ();
132138 TORCH_CHECK (
@@ -167,7 +173,7 @@ void CpuDeviceInterface::convertAVFrameToFrameOutput(
167173 prevSwsFrameContext_ = swsFrameContext;
168174 }
169175 int resultHeight =
170- convertAVFrameToTensorUsingSwsScale (avFrame, outputTensor);
176+ convertAVFrameToTensorUsingSwScale (avFrame, outputTensor);
171177 // If this check failed, it would mean that the frame wasn't reshaped to
172178 // the expected height.
173179 // TODO: Can we do the same check for width?
@@ -227,7 +233,7 @@ void CpuDeviceInterface::convertAVFrameToFrameOutput(
227233 }
228234}
229235
230- int CpuDeviceInterface::convertAVFrameToTensorUsingSwsScale (
236+ int CpuDeviceInterface::convertAVFrameToTensorUsingSwScale (
231237 const UniqueAVFrame& avFrame,
232238 torch::Tensor& outputTensor) {
233239 uint8_t * pointers[4 ] = {
0 commit comments