About my investigation:
I created multiple sets with test images having one dark object moving on a light background. For each set, the brightness of the background is different. The brightness of the object remains the same. A single image looks like this:
I encoded the images using a lossless H.265 encoding (see NVIDIA developer forum):
gst-launch-1.0 multifilesrc location=ramp228/image_ramp_%d.png start-index=1 stop-index=1000 caps='image/png, framerate=25/1, format=GRAY8' ! pngdec ! queue ! videoconvert ! nvvidconv ! nvv4l2h265enc control-rate=0 qp-range='0,1:0,1:0,1' quant-i-frames=0 quant-p-frames=0 ! h265parse ! qtmux ! filesink location=ramp228.mp4 -e
A contrast spreading can be seen in all resulting videos. The brightness of the dark object has changed regardless of the background by 15 units. The brightness of the backgrounds also changed, with brighter backgrounds showing a stronger change. The following table contains the original brightness values and the values after encoding:
The following figure describes the contrast spread using a histogram for the image shown above before and after encoding. It is noticeable that the two maxima (dark object and light background) shift outward.
I hope you can help me with this issue and look forward to your responses.