Combine encoding into DeviceInterface#1213
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/meta-pytorch/torchcodec/1213
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit e27a05a with merge base 06d4538 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
| return std::string("CPU Device Interface."); | ||
| } | ||
|
|
||
| UniqueAVFrame CpuDeviceInterface::convertTensorToAVFrameForEncoding( |
There was a problem hiding this comment.
CPU specific encoding implementation is removed from Encoder.cpp and added here.
There was a problem hiding this comment.
just checking: this is 100% copy/pasted, correct?
There was a problem hiding this comment.
Yes, the main difference is that Encoder.h's member variables are replaced by the local variables on lines 513-518.
This made me realize we can remove those member variables from Encoder.h entirely, since they are unused.
| UniqueEncodingAVFormatContext avFormatContext_; | ||
| UniqueAVCodecContext avCodecContext_; | ||
| AVStream* avStream_ = nullptr; | ||
| UniqueSwsContext swsContext_; |
There was a problem hiding this comment.
This member variable is deleted in favor of the swsContext_ in CpuDeviceInterface.h.
| // It is here to isolate CUDA dependencies from CPU builds | ||
| // TODO Video-Encoder: Reconsider using video encoding functions in device | ||
| // interface | ||
| virtual UniqueAVFrame convertCUDATensorToAVFrameForEncoding( |
There was a problem hiding this comment.
We replace convertCUDATensor... with convertTensor... to integrate into the device interface pattern.
…o refactor_device_interface_together
| return std::string("CPU Device Interface."); | ||
| } | ||
|
|
||
| UniqueAVFrame CpuDeviceInterface::convertTensorToAVFrameForEncoding( |
There was a problem hiding this comment.
just checking: this is 100% copy/pasted, correct?
This PR merges encoding into the DeviceInterface pattern.
deviceInterface_member variable defined, and uses it to call encoding functions.