Square (JPEG-like) artifacts are produced when images are enlarged by "Bicubic (smooth gradients)" interpolation. Their size depends on the size of the enlargement of image. If the enlargement is N*100% the artifacts have a size of NxN px, where N = 3,4,5, etc. If the enlargement is too large (1000% for example) artifacts will be lost in the blurry image. A good enlargement for observing artifacts is 400%. Artifacts are produced in both RGB and Grayscale mode.
sample40x40px_rgb24bbic400pct_-01392af3-6dbc-4a2e-b3bc-0cec32987263-323135953.png
(Resizing was done in Photoshop 22.0.1, but artifacts can also be observed in earlier versions of Photoshop.)
Other software that uses bicubic interpolation to enlarge images (Wolfram Mathematica or Affinity Photo) does not produce such artifacts (see below). In fact, there is minimal difference between Wolfram Mathematica's output and Affinity Photo.
sample40x40px_rgb24bbic400pct_-c3a690f4-2bc3-4d05-a268-bc73ec53a291-462874460.png
sample40x40px_rgb24bbic400pct_-60520a4f-9709-4f88-9c1d-7df4694fcfcc-1113918190.png
Artifacts are not visible when "Bicubic Smoother (enlargement)" is used when enlarging images. However, this interpolation produces too blurry images compared to regular Bicubic interpolation.
Are these artifacts in "Bicubic (smooth grad.)" interpolation a side effect of some performance optimization in Photoshop, or is it a bug?
Thanks
Update (2020-12-22): The description of the problem was supported by images. In images, a magnification of 1000% actually means enlarging the image using Photoshop nearest-neighbor scaling algorithm (i.e. the non-destructive algorithm) after bicubic resizing. The source image had a color depth of 24 bits. The difference in implementation between the bicubic algorithm of Photoshop and other programs is best observed by opening the above images in separate browser tabs (i.e. in full screen).
Source image (40x40px, 8bits per channel):
sample40x40px_rgb24b-df1c15c0-c7c1-45e3-b56d-44e11b2cd796-2029135863.png