Skip to content

Commit 280616a

Browse files
jantonguiraostiepan
authored andcommitted
Revert "Move old ImageDecoder to legacy module and make the nvImageCodec based ImageDecoder the default (#5445)" (#5464)
This reverts commit da8204c.
1 parent 0c99a11 commit 280616a

32 files changed

+567
-367
lines changed

dali/operators/decoder/host/fused/host_decoder_crop.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ HostDecoderCrop::HostDecoderCrop(const OpSpec &spec)
2929
, CropAttr(spec) {
3030
}
3131

32-
DALI_REGISTER_OPERATOR(legacy__decoders__ImageCrop, HostDecoderCrop, CPU);
32+
DALI_REGISTER_OPERATOR(decoders__ImageCrop, HostDecoderCrop, CPU);
33+
DALI_REGISTER_OPERATOR(ImageDecoderCrop, HostDecoderCrop, CPU);
3334

3435
} // namespace dali

dali/operators/decoder/host/fused/host_decoder_random_crop.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ HostDecoderRandomCrop::DeserializeCheckpoint(OpCheckpoint &cpt, const std::strin
4444
SnapshotSerializer().Deserialize<std::vector<std::mt19937>>(data);
4545
}
4646

47-
DALI_REGISTER_OPERATOR(legacy__decoders__ImageRandomCrop, HostDecoderRandomCrop, CPU);
47+
DALI_REGISTER_OPERATOR(decoders__ImageRandomCrop, HostDecoderRandomCrop, CPU);
48+
DALI_REGISTER_OPERATOR(ImageDecoderRandomCrop, HostDecoderRandomCrop, CPU);
4849

4950
} // namespace dali

dali/operators/decoder/host/fused/host_decoder_random_crop_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2019 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
1+
// Copyright (c) 2019 NVIDIA CORPORATION. All rights reserved.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -80,7 +80,7 @@ TEST_F(ImageRandomCropCheckpointingTest_CPU, Simple) {
8080
.AddArg("files", std::vector{filepath}));
8181

8282
pipe.AddOperator(
83-
OpSpec("legacy__decoders__ImageRandomCrop")
83+
OpSpec("decoders__ImageRandomCrop")
8484
.AddInput("file", "cpu")
8585
.AddOutput("decoded", "cpu"));
8686

dali/operators/decoder/host/fused/host_decoder_slice.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ HostDecoderSlice::HostDecoderSlice(const OpSpec &spec)
2828
, slice_attr_(spec) {
2929
}
3030

31-
DALI_REGISTER_OPERATOR(legacy__decoders__ImageSlice, HostDecoderSlice, CPU);
31+
DALI_REGISTER_OPERATOR(decoders__ImageSlice, HostDecoderSlice, CPU);
32+
DALI_REGISTER_OPERATOR(ImageDecoderSlice, HostDecoderSlice, CPU);
3233

3334
} // namespace dali

dali/operators/decoder/host/host_decoder.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ void HostDecoder::RunImpl(SampleWorkspace &ws) {
5050
std::memcpy(out_data, decoded.get(), volume(shape));
5151
}
5252

53-
DALI_REGISTER_OPERATOR(legacy__decoders__Image, HostDecoder, CPU);
53+
DALI_REGISTER_OPERATOR(decoders__Image, HostDecoder, CPU);
54+
DALI_REGISTER_OPERATOR(ImageDecoder, HostDecoder, CPU);
5455

5556
} // namespace dali

dali/operators/decoder/image_decoder.cc

Lines changed: 59 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2019-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
1+
// Copyright (c) 2019-2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -163,12 +163,9 @@ allocation might be useful to determine suitable values for ``device_memory_padd
163163
)code",
164164
false);
165165

166-
DALI_SCHEMA(legacy__decoders__Image)
166+
DALI_SCHEMA(decoders__Image)
167167
.DocStr(R"code(Decodes images.
168168
169-
.. warning::
170-
This is a legacy implementation of the image decoder. Use the ``decoders`` module instead.
171-
172169
For jpeg images, depending on the backend selected ("mixed" and "cpu"), the implementation uses
173170
the *nvJPEG* library or *libjpeg-turbo*, respectively. Other image formats are decoded
174171
with *OpenCV* or other specific libraries, such as *libtiff*.
@@ -198,13 +195,10 @@ Please note that GPU acceleration for JPEG 2000 decoding is only available for C
198195

199196
// Fused
200197

201-
DALI_SCHEMA(legacy__decoders__ImageCrop)
198+
DALI_SCHEMA(decoders__ImageCrop)
202199
.DocStr(R"code(Decodes images and extracts regions-of-interest (ROI) that are specified
203200
by fixed window dimensions and variable anchors.
204201
205-
.. warning::
206-
This is a legacy implementation of the image decoder. Use the ``decoders`` module instead.
207-
208202
When possible, the argument uses the ROI decoding APIs (for example, *libjpeg-turbo* and *nvJPEG*)
209203
to reduce the decoding time and memory usage. When the ROI decoding is not supported for a given
210204
image format, it will decode the entire image and crop the selected ROI.
@@ -225,12 +219,9 @@ Supported formats: JPG, BMP, PNG, TIFF, PNM, PPM, PGM, PBM, JPEG 2000, WebP.
225219
.AddParent("ImageDecoderAttr")
226220
.AddParent("CropAttr");
227221

228-
DALI_SCHEMA(legacy__decoders__ImageRandomCrop)
222+
DALI_SCHEMA(decoders__ImageRandomCrop)
229223
.DocStr(R"code(Decodes images and randomly crops them.
230224
231-
.. warning::
232-
This is a legacy implementation of the image decoder. Use the ``decoders`` module instead.
233-
234225
The cropping window's area (relative to the entire image) and aspect ratio can be restricted to
235226
a range of values specified by ``area`` and ``aspect_ratio`` arguments, respectively.
236227
@@ -255,12 +246,9 @@ Supported formats: JPG, BMP, PNG, TIFF, PNM, PPM, PGM, PBM, JPEG 2000, WebP.
255246
.AddParent("RandomCropAttr");
256247

257248

258-
DALI_SCHEMA(legacy__decoders__ImageSlice)
249+
DALI_SCHEMA(decoders__ImageSlice)
259250
.DocStr(R"code(Decodes images and extracts regions of interest.
260251
261-
.. warning::
262-
This is a legacy implementation of the image decoder. Use the ``decoders`` module instead.
263-
264252
The slice can be specified by proving the start and end coordinates, or start coordinates
265253
and shape of the slice. Both coordinates and shapes can be provided in absolute or relative terms.
266254
@@ -323,4 +311,58 @@ Integer coordinates are interpreted as absolute coordinates, while float coordin
323311
interpreted as absolute or relative coordinates, depending on the value of
324312
``normalized_shape``.)code");
325313

314+
315+
// Deprecated aliases
316+
317+
DALI_SCHEMA(ImageDecoder)
318+
.DocStr("Legacy alias for :meth:`decoders.image`.")
319+
.NumInput(1)
320+
.NumOutput(1)
321+
.AddParent("decoders__Image")
322+
.MakeDocPartiallyHidden()
323+
.Deprecate(
324+
"decoders__Image",
325+
R"code(In DALI 1.0 all decoders were moved into a dedicated :mod:`~nvidia.dali.fn.decoders`
326+
submodule and renamed to follow a common pattern. This is a placeholder operator with identical
327+
functionality to allow for backward compatibility.)code"); // Deprecated in 1.0
328+
329+
// Fused
330+
331+
DALI_SCHEMA(ImageDecoderCrop)
332+
.DocStr("Legacy alias for :meth:`decoders.image_crop`.")
333+
.NumInput(1)
334+
.NumOutput(1)
335+
.AddParent("decoders__ImageCrop")
336+
.MakeDocPartiallyHidden()
337+
.Deprecate(
338+
"decoders__ImageCrop",
339+
R"code(In DALI 1.0 all decoders were moved into a dedicated :mod:`~nvidia.dali.fn.decoders`
340+
submodule and renamed to follow a common pattern. This is a placeholder operator with identical
341+
functionality to allow for backward compatibility.)code"); // Deprecated in 1.0
342+
343+
DALI_SCHEMA(ImageDecoderRandomCrop)
344+
.DocStr("Legacy alias for :meth:`decoders.image_random_crop`.")
345+
.NumInput(1)
346+
.NumOutput(1)
347+
.AddParent("decoders__ImageRandomCrop")
348+
.MakeDocPartiallyHidden()
349+
.Deprecate(
350+
"decoders__ImageRandomCrop",
351+
R"code(In DALI 1.0 all decoders were moved into a dedicated :mod:`~nvidia.dali.fn.decoders`
352+
submodule and renamed to follow a common pattern. This is a placeholder operator with identical
353+
functionality to allow for backward compatibility.)code"); // Deprecated in 1.0
354+
355+
356+
DALI_SCHEMA(ImageDecoderSlice)
357+
.DocStr("Legacy alias for :meth:`decoders.image_slice`.")
358+
.NumInput(1, 3)
359+
.NumOutput(1)
360+
.AddParent("decoders__ImageSlice")
361+
.MakeDocPartiallyHidden()
362+
.Deprecate(
363+
"decoders__ImageSlice",
364+
R"code(In DALI 1.0 all decoders were moved into a dedicated :mod:`~nvidia.dali.fn.decoders`
365+
submodule and renamed to follow a common pattern. This is a placeholder operator with identical
366+
functionality to allow for backward compatibility.)code"); // Deprecated in 1.0
367+
326368
} // namespace dali

dali/operators/decoder/nvjpeg/fused/nvjpeg_decoder_crop.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2019-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
1+
// Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@
1717

1818
namespace dali {
1919

20-
DALI_REGISTER_OPERATOR(legacy__decoders__ImageCrop, nvJPEGDecoderCrop, Mixed);
20+
DALI_REGISTER_OPERATOR(decoders__ImageCrop, nvJPEGDecoderCrop, Mixed);
21+
DALI_REGISTER_OPERATOR(ImageDecoderCrop, nvJPEGDecoderCrop, Mixed);
2122

2223
} // namespace dali

dali/operators/decoder/nvjpeg/fused/nvjpeg_decoder_random_crop.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2019-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
1+
// Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -40,6 +40,7 @@ nvJPEGDecoderRandomCrop::DeserializeCheckpoint(OpCheckpoint &cpt, const std::str
4040
SnapshotSerializer().Deserialize<std::vector<std::mt19937>>(data);
4141
}
4242

43-
DALI_REGISTER_OPERATOR(legacy__decoders__ImageRandomCrop, nvJPEGDecoderRandomCrop, Mixed);
43+
DALI_REGISTER_OPERATOR(decoders__ImageRandomCrop, nvJPEGDecoderRandomCrop, Mixed);
44+
DALI_REGISTER_OPERATOR(ImageDecoderRandomCrop, nvJPEGDecoderRandomCrop, Mixed);
4445

4546
} // namespace dali

dali/operators/decoder/nvjpeg/fused/nvjpeg_decoder_random_crop_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2019-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
1+
// Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -80,7 +80,7 @@ TEST_F(ImageRandomCropCheckpointingTest_GPU, Simple) {
8080
.AddArg("files", std::vector{filepath}));
8181

8282
pipe.AddOperator(
83-
OpSpec("legacy__decoders__ImageRandomCrop")
83+
OpSpec("decoders__ImageRandomCrop")
8484
.AddInput("file", "cpu")
8585
.AddOutput("decoded", "gpu")
8686
.AddArg("device", "mixed"));

dali/operators/decoder/nvjpeg/fused/nvjpeg_decoder_slice.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2019-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
1+
// Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@
1717

1818
namespace dali {
1919

20-
DALI_REGISTER_OPERATOR(legacy__decoders__ImageSlice, nvJPEGDecoderSlice, Mixed);
20+
DALI_REGISTER_OPERATOR(decoders__ImageSlice, nvJPEGDecoderSlice, Mixed);
21+
DALI_REGISTER_OPERATOR(ImageDecoderSlice, nvJPEGDecoderSlice, Mixed);
2122

2223
} // namespace dali

0 commit comments

Comments
 (0)