Quality of VideoToolbox's H265/HEVC when using text as a source

Viewed 27

I'm trying to understand the limits of quality for H264 and HEVC compressing when using Apple's Video Toolbox API (VTCompressionSessionCreate, etc.).

When I use either compression with videos it looks pretty good, but when I try with a simple webpage, I see the text looks slightly blurry, and if I zoom in I see there seems to be some anti-aliasing being applied. (Note: none of my code is explicitly doing any anti-aliasing.)

Below you can see the upper left portion of a 'P' letter, before and after the compression.

(Note: these come from a screenshot but even just with my eye I can tell it is blurry.)

H264 compressed original

I tried changing a bunch of settings on H264 (different profiles, bitrate, etc.) but I can't get the quality any better. I am compressing to the same resolution as the source image.

I also briefly tried HEVC (which I heard is supposed to be lossless), but I didn't see much improvement.

I might be doing something incorrect, but before I get much deeper I wanted to figure out if this is what is to be expected of H265/HEVC when compressing text like this.

If this is not expected, can someone point me to sample code that will show better quality with text, or give me some pointers to what encoding I should use?

EDIT:

As an experiment I tried to save the CVImageBufferRef to a PNG and then look at that. Overall the quality is a bit better (at least there is less anti-aliasing), but it is still not as good as the original.

enter image description here

EDIT2: Actually, I am doubting the validity of this PNG test since the colors seem to indicate there is some additional compression going on (there is more color variation inside the letter), which doesn't make sense since I am using PNG which is supposedly lossless.

0 Answers
Related