[trunk] As per T.809 code block are not shifted in JP3D

Table A.7 
3D code-block width, height and depth exponent values xcb = value, ycb = value
or zcb = value.
NOTE – This redefines Rec. ITU-T T.800 | ISO/IEC 15444-1 significantly! The 3D
code-block width, height and depth are limited to powers of two with the minimum
size being 20 and the maximum being 210.
Further, the 3D code-block size is restricted so that 4 ≤ xcb+ycb+zcb ≤ 18.
This commit is contained in:
Mathieu Malaterre 2012-11-28 13:06:02 +00:00
parent be5e6941bf
commit 863fdafcd5
1 changed files with 17 additions and 7 deletions

View File

@ -809,6 +809,7 @@ static void j3d_read_com(opj_j3d_t *j3d) {
static void j3d_write_cox(opj_j3d_t *j3d, int compno) { static void j3d_write_cox(opj_j3d_t *j3d, int compno) {
int i; int i;
int shift = 2;
opj_cp_t *cp = j3d->cp; opj_cp_t *cp = j3d->cp;
opj_tcp_t *tcp = &cp->tcps[j3d->curtileno]; opj_tcp_t *tcp = &cp->tcps[j3d->curtileno];
@ -820,11 +821,15 @@ static void j3d_write_cox(opj_j3d_t *j3d, int compno) {
cio_write(cio, tccp->numresolution[1] - 1, 1); /* SPcox (E) No of decomposition levels in y-axis*/ cio_write(cio, tccp->numresolution[1] - 1, 1); /* SPcox (E) No of decomposition levels in y-axis*/
cio_write(cio, tccp->numresolution[2] - 1, 1); /* SPcox (F) No of decomposition levels in z-axis*/ cio_write(cio, tccp->numresolution[2] - 1, 1); /* SPcox (F) No of decomposition levels in z-axis*/
} }
/* (cblkw - 2) + (cblkh - 2) + (cblkl - 2) <= 18*/
cio_write(cio, tccp->cblk[0] - 2, 1); /* SPcox (G) Cblk width entre 10 y 2 (8 y 0)*/
cio_write(cio, tccp->cblk[1] - 2, 1); /* SPcox (H) Cblk height*/
if (j3d->cinfo->codec_format == CODEC_J3D) { if (j3d->cinfo->codec_format == CODEC_J3D) {
cio_write(cio, tccp->cblk[2] - 2, 1); /* SPcox (I) Cblk depth*/ /* Table A.7 */
shift = 0;
}
/* (cblkw - 2) + (cblkh - 2) + (cblkl - 2) <= 18*/
cio_write(cio, tccp->cblk[0] - shift, 1); /* SPcox (G) Cblk width entre 10 y 2 (8 y 0)*/
cio_write(cio, tccp->cblk[1] - shift, 1); /* SPcox (H) Cblk height*/
if (j3d->cinfo->codec_format == CODEC_J3D) {
cio_write(cio, tccp->cblk[2] - shift, 1); /* SPcox (I) Cblk depth*/
} }
cio_write(cio, tccp->cblksty, 1); /* SPcox (J) Cblk style*/ cio_write(cio, tccp->cblksty, 1); /* SPcox (J) Cblk style*/
cio_write(cio, tccp->dwtid[0], 1); /* SPcox (K) WT in x-axis 15444-2 Table A10*/ cio_write(cio, tccp->dwtid[0], 1); /* SPcox (K) WT in x-axis 15444-2 Table A10*/
@ -847,6 +852,7 @@ static void j3d_write_cox(opj_j3d_t *j3d, int compno) {
static void j3d_read_cox(opj_j3d_t *j3d, int compno) { static void j3d_read_cox(opj_j3d_t *j3d, int compno) {
int i; int i;
int shift = 2;
opj_cp_t *cp = j3d->cp; opj_cp_t *cp = j3d->cp;
opj_tcp_t *tcp = j3d->state == J3D_STATE_TPH ? &cp->tcps[j3d->curtileno] : j3d->default_tcp; opj_tcp_t *tcp = j3d->state == J3D_STATE_TPH ? &cp->tcps[j3d->curtileno] : j3d->default_tcp;
@ -866,10 +872,14 @@ static void j3d_read_cox(opj_j3d_t *j3d, int compno) {
cp->reduce[1] = int_min((tccp->numresolution[1])-1, cp->reduce[1]); cp->reduce[1] = int_min((tccp->numresolution[1])-1, cp->reduce[1]);
cp->reduce[2] = int_min((tccp->numresolution[2])-1, cp->reduce[2]); cp->reduce[2] = int_min((tccp->numresolution[2])-1, cp->reduce[2]);
tccp->cblk[0] = cio_read(cio, 1) + 2; /* SPcox (G) */ if (j3d->cinfo->codec_format == CODEC_J3D) {
tccp->cblk[1] = cio_read(cio, 1) + 2; /* SPcox (H) */ /* Table A.7 */
shift = 0;
}
tccp->cblk[0] = cio_read(cio, 1) + shift; /* SPcox (G) */
tccp->cblk[1] = cio_read(cio, 1) + shift; /* SPcox (H) */
if (j3d->cinfo->codec_format == CODEC_J3D) if (j3d->cinfo->codec_format == CODEC_J3D)
tccp->cblk[2] = cio_read(cio, 1) + 2; /* SPcox (I) */ tccp->cblk[2] = cio_read(cio, 1) + shift; /* SPcox (I) */
else else
tccp->cblk[2] = tccp->cblk[0]; tccp->cblk[2] = tccp->cblk[0];