@@ -55,7 +55,6 @@ bool VideoDecoderMixed::SetupImpl(
55
55
sample.data_provider_ = std::make_unique<MemoryVideoFile>(input.raw_tensor (i), input[i].shape ().num_elements ());
56
56
sample.demuxer_ = std::make_unique<FFmpegDemuxer>(sample.data_provider_ .get ());
57
57
sample.current_packet_ = std::make_unique<PacketData>();
58
- std::cout << " Sample #" << i << " {10x" << sample.demuxer_ ->GetHeight () << " x" << sample.demuxer_ ->GetWidth () << " x" << 3 << " }\n " ;
59
58
sh.set_tensor_shape (i, dali::TensorShape<>(10 , sample.demuxer_ ->GetHeight (), sample.demuxer_ ->GetWidth (), 3 ));
60
59
}
61
60
output_desc.resize (1 );
@@ -92,49 +91,26 @@ void VideoDecoderMixed::Run(dali::Workspace &ws) {
92
91
93
92
cuCtxPushCurrent (cuContext);
94
93
cuStreamCreate (&cuStream, 0 );
95
- cuCtxPopCurrent (nullptr );
96
94
97
- cuCtxPushCurrent (cuContext);
98
-
99
95
for (int i = 0 ; i < batch_size; i++) {
100
- auto & sample = samples_[i];
96
+ auto & sample = samples_[i];
101
97
sample.decoder_ = std::make_unique<NvDecoder>(
102
98
cuStream, cuContext, true , FFmpeg2NvCodecId (sample.demuxer_ ->GetVideoCodec ()), false ,
103
99
false /* _enableasyncallocations*/ , false );
104
100
105
101
106
- uint8_t * pVideo = NULL ;
102
+ uint8_t * pVideo = NULL ;
107
103
int nVideoBytes = 0 ;
108
104
while (sample.demuxer_ ->Demux (&pVideo, &nVideoBytes)) {
109
105
if (nVideoBytes) {
110
106
auto vecTupFrame = sample.decoder_ ->Decode (pVideo, nVideoBytes);
111
107
}
112
108
}
113
-
114
- cuCtxPopCurrent (&cuContext);
115
-
116
- // uint8_t* data = nullptr;
117
- // int data_size = 0;
118
-
119
- // data_provider_ = std::make_unique<HostMemDataProvider>(data, data_size);
120
- // demuxer_ = std::make_unique<FFmpegDemuxer>(data_provider_.get());
121
- // current_packet_ = std::make_unique<PacketData>();
122
-
123
- // int nVideoBytes = 0, nFrameReturned = 0, nFrame = 0;
124
- // uint8_t* pVideo = NULL, * pFrame;
125
- // memset(current_packet_.get(), 0, sizeof(PacketData));
126
-
127
- // while (demuxer_->Demux(&pVideo, &nVideoBytes)) {
128
- // if (nVideoBytes) {
129
- // current_packet_->bsl_data = (uintptr_t)pVideo;
130
- // current_packet_->bsl = nVideoBytes;
131
- // }
132
- // }
133
109
}
110
+ cuCtxPopCurrent (&cuContext);
134
111
}
135
112
136
113
137
-
138
114
DALI_SCHEMA (plugin__video__decoders__Video)
139
115
.DocStr(
140
116
R"code( Decodes a video file from a memory buffer (e.g. provided by external source).
0 commit comments