summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorMathieu Malaterre <mathieu.malaterre@gmail.com>2012-11-28 13:06:02 +0000
committerMathieu Malaterre <mathieu.malaterre@gmail.com>2012-11-28 13:06:02 +0000
commit863fdafcd5311db5f5a3de8e26b988f5f9111e5b (patch)
tree2a96471fbc8c534763e08e734a464602eb4c8337 /src/lib
parentbe5e6941bfa341f95fdb10ae5aca4292a50f8767 (diff)
[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.
Diffstat (limited to 'src/lib')
-rwxr-xr-xsrc/lib/openjp3d/jp3d.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/lib/openjp3d/jp3d.c b/src/lib/openjp3d/jp3d.c
index c21d7442..de4b2266 100755
--- a/src/lib/openjp3d/jp3d.c
+++ b/src/lib/openjp3d/jp3d.c
@@ -809,6 +809,7 @@ static void j3d_read_com(opj_j3d_t *j3d) {
static void j3d_write_cox(opj_j3d_t *j3d, int compno) {
int i;
+ int shift = 2;
opj_cp_t *cp = j3d->cp;
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[2] - 1, 1); /* SPcox (F) No of decomposition levels in z-axis*/
}
+ if (j3d->cinfo->codec_format == CODEC_J3D) {
+ /* Table A.7 */
+ shift = 0;
+ }
/* (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*/
+ 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] - 2, 1); /* SPcox (I) Cblk depth*/
+ 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->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) {
int i;
+ int shift = 2;
opj_cp_t *cp = j3d->cp;
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[2] = int_min((tccp->numresolution[2])-1, cp->reduce[2]);
- tccp->cblk[0] = cio_read(cio, 1) + 2; /* SPcox (G) */
- tccp->cblk[1] = cio_read(cio, 1) + 2; /* SPcox (H) */
+ if (j3d->cinfo->codec_format == CODEC_J3D) {
+ /* 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)
- tccp->cblk[2] = cio_read(cio, 1) + 2; /* SPcox (I) */
+ tccp->cblk[2] = cio_read(cio, 1) + shift; /* SPcox (I) */
else
tccp->cblk[2] = tccp->cblk[0];