Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

would you please let me know why return "img, F.upscale(img, self.upscale_factor, self.interpolation)" with 2 images? thanks #35

Open
semchan opened this issue Sep 25, 2020 · 2 comments

Comments

@semchan
Copy link

semchan commented Sep 25, 2020

class Upscale(object):
def init(self, upscale_factor=2, interpolation='BILINEAR'):
self.upscale_factor = upscale_factor
self.interpolation = interpolation

def __call__(self, img):
    return img, F.upscale(img, self.upscale_factor, self.interpolation)
@Fish08042
Copy link

because in the next step,we need to use transforms.TransformUpscaledDCT(),you can figure out it by reading next code:

class TransformUpscaledDCT(object):
def init(self):
self.jpeg_encoder = TurboJPEG(libjpeg_path)
# self.jpeg_encoder = TurboJPEG('/home/kai.x/work/local/lib/libturbojpeg.so')

def __call__(self, img):
    y, cbcr = img[0], img[1]
    dct_y, _, _ = F.transform_dct(y, self.jpeg_encoder)
    _, dct_cb, dct_cr = F.transform_dct(cbcr, self.jpeg_encoder)
    return dct_y, dct_cb, dct_cr

@usamahjundia-gdp
Copy link

class Upscale(object):
def init(self, upscale_factor=2, interpolation='BILINEAR'):
self.upscale_factor = upscale_factor
self.interpolation = interpolation

def __call__(self, img):
    return img, F.upscale(img, self.upscale_factor, self.interpolation)

might be far too late to answer this but i hope this will be beneficial for future readers hahah.

Was wondering the same, but upon inspecting jpeg2dct, the default behaviour is when converting an image into DCT, the Y channel has 2 times the width and height of the Cr and CB channels. We want them all to have the same sizes so we do separate calculations, one with the original image size to get the Y channel DCT, and the other with twice the original image size to get the Cr and Cb channel of the DCT, which because of the 2x resize, has the width and height of the Cr and Cb DCT result the same as the Y DCT result. Then we can easily "resize" them and concat them together

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants