[Live-devel] JPEG Video RTP Source ignores quantization table precision

Joshua Hitchen Josh at metrosecurity.co.uk
Thu Mar 8 04:08:15 PST 2018


> This may (perhaps) have been an oversight.  The “JPEGVideoRTPSource” code basically just implements the code that’s in Appendix B of RFC 2435 (which defines the RTP payload format for JPEG video).  I.e., it
> transforms the information that was in the special RTP JPEG header (and quantization tables, if present) into a corresponding JPEG image header.  It’s possible that this code is incomplete.

Appendix B does specifically state that the code there is only for 8 bit precision quantization tables, but here is a code snippet for recognising the presence of double precision tables:

(first uncomment the declaration of precision at line 384, then insert this after the declaration of length on the next line)

unsigned curLen = 0;
unsigned numtables = 0;
for (int i = 8; i >= 0; i--) //each bit in the Precision field indicates value of a table read from right to left; 0 for 8 bit, 1 for 16 bit (see RFC 2435 section 3.1.8)
{
	if(curLen >= Length) break; //Ignore excess bits after all tables are accounted for.
	numtables++;
	curLen += 64 * ((Precision & (1 << i - 1) + 1); //Set up for when 16 bit tables become supported. Equivalent to 64 * ((Precision & 2^(i-1)) + 1).
	if((Precision & (1 << i - 1) == 0) return False; //Currently unsupported - 16 bit precision table.
}


Regards

Josh Hitchen
Development

Metro Security (GB) PLC
www.metrosecurity.co.uk



More information about the live-devel mailing list