From: Tim B. <tim...@us...> - 2007-02-22 13:46:40
|
Update of /cvsroot/dirac/diracpro In directory sc8-pr-cvs12.sourceforge.net:/tmp/cvs-serv7514 Modified Files: mezzanine_decoder.c mezzanine_encoder.c Log Message: Encoder and decoder now use 7 bits for holding the quantiser index (rather than 6 previously) Six bits are sufficient for this application (hence the 7th bit is explicitly always zero), but seven bits may be required for other applications. So seven bits used here for consistency across all Dirac Pro applications. The cost of using this extra bit is about 0.04dB in this application, which seemed reasonable to achieve consistency across all applications. Index: mezzanine_encoder.c =================================================================== RCS file: /cvsroot/dirac/diracpro/mezzanine_encoder.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** mezzanine_encoder.c 31 Jan 2007 17:31:02 -0000 1.3 --- mezzanine_encoder.c 22 Feb 2007 13:46:34 -0000 1.4 *************** *** 3,7 **** /* Reference Version */ /* Author: Tim Borer, BBC Research */ ! /* This version 30th January 2007 */ /* adapted from the work of R.T. Russel, BBC R&D, 06 May 2006 */ /* Copyright (c) 2005-2006 The British Broadcasting Corporation */ --- 3,7 ---- /* Reference Version */ /* Author: Tim Borer, BBC Research */ ! /* This version 22nd February 2007 */ /* adapted from the work of R.T. Russel, BBC R&D, 06 May 2006 */ /* Copyright (c) 2005-2006 The British Broadcasting Corporation */ *************** *** 44,48 **** char version[] = ! "Dirac Pro mezzanine encoder, Reference Version 05, 30th January 2007"; char copyright[] = "Copyright (c) 2005-2007 BBC"; --- 44,48 ---- char version[] = ! "Dirac Pro mezzanine encoder, Reference Version 07, 22nd February 2007"; char copyright[] = "Copyright (c) 2005-2007 BBC"; *************** *** 491,495 **** ++q; bitcount(w, u, v, ydc, udc, vdc, ybcount, xbcount, q, &ybitcount, &uvbitcount); ! } while ( (ybitcount+uvbitcount+15) > (XBLOCK * YBLOCK * 8) ); stats[q] ++; --- 491,495 ---- ++q; bitcount(w, u, v, ydc, udc, vdc, ybcount, xbcount, q, &ybitcount, &uvbitcount); ! } while ( (ybitcount+uvbitcount+16) > (XBLOCK * YBLOCK * 8) ); stats[q] ++; *************** *** 498,502 **** // Now we can encode the block: pmb (out_buffer, q, 6, 0, 6); // quantisation code ! pmb (out_buffer, ybitcount, 9, 0, 15); // number of bits to code y // Encode luminance: --- 498,503 ---- // Now we can encode the block: pmb (out_buffer, q, 6, 0, 6); // quantisation code ! pmb (out_buffer, 0, 1, 0, 7); // Add zero MSB to quantisation code ! pmb (out_buffer, ybitcount, 9, 0, 16); // number of bits to code y // Encode luminance: *************** *** 504,508 **** static int ydc[YBTOT][XBTOT]; int y = yscan_y[z], x = xscan_y[z]; ! encode(y, x, w, out_buffer, q, ybcount, xbcount, ydc, 15+ybitcount); } --- 505,509 ---- static int ydc[YBTOT][XBTOT]; int y = yscan_y[z], x = xscan_y[z]; ! encode(y, x, w, out_buffer, q, ybcount, xbcount, ydc, 16+ybitcount); } Index: mezzanine_decoder.c =================================================================== RCS file: /cvsroot/dirac/diracpro/mezzanine_decoder.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** mezzanine_decoder.c 13 Feb 2007 12:25:02 -0000 1.3 --- mezzanine_decoder.c 22 Feb 2007 13:46:34 -0000 1.4 *************** *** 2,6 **** /* Dirac Pro, mezzanine decoder for 1080P50 to 1080I25 compression */ /* Author: Tim Borer, BBC Research */ ! /* This version 5th February 2007 */ /* adapted from the work of R.T. Russel, BBC R&D, 06 May 2006 */ /* Copyright (c) 2005-2006 The British Broadcasting Corporation */ --- 2,6 ---- /* Dirac Pro, mezzanine decoder for 1080P50 to 1080I25 compression */ /* Author: Tim Borer, BBC Research */ ! /* This version 13th February 2007 */ /* adapted from the work of R.T. Russel, BBC R&D, 06 May 2006 */ /* Copyright (c) 2005-2006 The British Broadcasting Corporation */ *************** *** 42,46 **** char version[] = ! "Dirac Pro mezzanine decoder, Reference Version 05, 5th February 2007"; char copyright[] = "Copyright (c) 2005-2007 BBC"; --- 42,46 ---- char version[] = ! "Dirac Pro mezzanine decoder, Reference Version 07, 13th February 2007"; char copyright[] = "Copyright (c) 2005-2007 BBC"; *************** *** 374,384 **** // Get quantisation code: ! q = gmb(in_buffer, 6, 1, 6); ! ybitcount = gmb(in_buffer, 9, 0, 15); // Decode luminance: for (z=0; z<(YBLOCK*XBLOCK); ++z) { int y=yscan_y[z], x=xscan_y[z]; ! w[y][x] = decodecoefficient(y, x, q, ybcount, xbcount, ydc, in_buffer, 15+ybitcount); } --- 374,385 ---- // Get quantisation code: ! q = gmb(in_buffer, 6, 1, 6); ! gmb(in_buffer, 1, 0, 7); // Read zero MSB of q ! ybitcount = gmb(in_buffer, 9, 0, 16); // Decode luminance: for (z=0; z<(YBLOCK*XBLOCK); ++z) { int y=yscan_y[z], x=xscan_y[z]; ! w[y][x] = decodecoefficient(y, x, q, ybcount, xbcount, ydc, in_buffer, 16+ybitcount); } |