Skip to content

The saved pictures pf DCVC-FM have obvious color differences. #85

Open

Description

@QIN921

I try to save the decoded frame of DCVC-FM of run_one_point_fast, so I add the code below:
recon_writer = PNGWriter(args['bin_folder'], args['src_width'], args['src_height'])
and

if save_decoded_frame:
                yuv_rec = x_hat.squeeze(0).cpu().numpy()
                rgb = ycbcr444_to_rgb(yuv_rec[:1, :, :], yuv_rec[1:, :, :])
                recon_writer.write_one_frame(rgb=rgb, src_format='rgb')

The metrics of saved json is as the paper report, but the result have obvious color differences and a 8dB PSNR drop.

Image

Activity

  1. yaohualibin commented on Mar 20, 2025

    @yaohualibin
    Contributor

    Are you encoding RGB or YUV? If RGB, are you using the same conversion matrix from YUV to RGB and RGB to YUV?

  2. QIN921 commented on Mar 20, 2025

    @QIN921
    Author

    The input are YUV videos, and i am trying to save RGB png

  3. yaohualibin commented on Mar 20, 2025

    @yaohualibin
    Contributor

    Does saving as YUV work as expected?

  4. QIN921 commented on Mar 20, 2025

    @QIN921
    Author

    Yes, saving as YUV work as expected.

  5. yaohualibin commented on Mar 20, 2025

    @yaohualibin
    Contributor

    Then I suspect different conversion methods were used to convert YUV to RGB.

  6. ichlubna commented on Apr 16, 2026

    @ichlubna

    For anyone interested. Added to test_helper.py:

    def save_yuv444(yuv, filepath):
        y = yuv[0]
        u = yuv[1]
        v = yuv[2]
    
        y = y * 255.0
        u = (u - 0.5) * 255.0 + 128.0
        v = (v - 0.5) * 255.0 + 128.0
    
        y = np.clip(y, 0, 255).astype(np.uint8)
        u = np.clip(u, 0, 255).astype(np.uint8)
        v = np.clip(v, 0, 255).astype(np.uint8)
    
        with open(filepath, "wb") as f:
            y.tofile(f)
            u.tofile(f)
            v.tofile(f)
    

    then using as

    yuv_rec = x_hat.squeeze(0).cpu().numpy()
    save_yuv444(yuv_rec,os.path.join(args['bin_folder'], "recon.yuv"))
    

    and then decoding to png as

    ffmpeg -f rawvideo -pix_fmt yuv444p -color_range pc -colorspace bt709 -color_trc bt709 -color_primaries bt709 -video_size 420x560 -i recon.yuv frame_%04d.png
    

    Seem to work well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions