  Available model-based techniques for the estimation of the primary
quantization matrix in double-compressed JPEG images work only under specific
conditions regarding the relationship between the first and second compression
quality factors, and the alignment of the first and second JPEG compression
grids. In this paper, we propose a single CNN-based estimation technique that
can work under a very general range of settings. We do so, by adapting a dense
CNN network to the problem at hand. Particular attention is paid to the choice
of the loss function. Experimental results highlight several advantages of the
new method, including: i) capability of working under very general conditions,
ii) improved performance in terms of MSE and accuracy especially in the
non-aligned case, iii) better spatial resolution due to the ability of
providing good results also on small image patches.
