diff --git a/applications/jpip/CHANGES b/applications/jpip/CHANGES index eca480ae..e57899f7 100644 --- a/applications/jpip/CHANGES +++ b/applications/jpip/CHANGES @@ -5,6 +5,9 @@ What's New for OpenJPIP ! : changed + : added +October 14, 2011 ++ [kaori] enable all progression orders + October 12, 2011 + [kaori] enable layers requests; restricting the number of codesream quality layers diff --git a/applications/jpip/libopenjpip/j2kheader_manager.c b/applications/jpip/libopenjpip/j2kheader_manager.c index b1b9d7f3..afbb2525 100644 --- a/applications/jpip/libopenjpip/j2kheader_manager.c +++ b/applications/jpip/libopenjpip/j2kheader_manager.c @@ -162,8 +162,7 @@ bool modify_mainheader( Byte_t *j2kstream, int numOfdecomp, SIZmarker_param_t SI if( !(newLcod = modify_CODmkrstream( COD, numOfdecomp, j2kstream))) return false; - // memmove( j2kstream+2+newLcod, j2kstream+2+COD.Lcod, (*j2klen)-(SIZ.Lsiz+newLcod+6));// new->oldLcod - memmove( j2kstream+2+newLcod, j2kstream+2+COD.Lcod, (*j2klen)-(SIZ.Lsiz+COD.Lcod+6)); + memmove( j2kstream+2+newLcod, j2kstream+2+COD.Lcod, (*j2klen)-(SIZ.Lsiz+COD.Lcod+6)); *j2klen -= ( COD.Lcod - newLcod); return true; diff --git a/applications/jpip/libopenjpip/jp2k_encoder.c b/applications/jpip/libopenjpip/jp2k_encoder.c index d379e62d..5025bf8e 100644 --- a/applications/jpip/libopenjpip/jp2k_encoder.c +++ b/applications/jpip/libopenjpip/jp2k_encoder.c @@ -223,10 +223,9 @@ Byte_t * recons_codestream_from_JPTstream( msgqueue_param_t *msgqueue, Byte_t *j Byte_t * add_SOTmkr( Byte_t *j2kstream, Byte8_t *j2klen); -Byte_t * recons_RPCLbitstream( msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte_t *j2kstream, Byte8_t csn, - Byte8_t tileID, SIZmarker_param_t SIZ, CODmarker_param_t COD, int mindeclev, - int *max_reslev, Byte8_t *j2klen); - +Byte_t * recons_bitstream( msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte_t *j2kstream, Byte8_t csn, + Byte8_t tileID, SIZmarker_param_t SIZ, CODmarker_param_t COD, int mindeclev, + int *max_reslev, Byte8_t *j2klen); Byte_t * recons_codestream_from_JPPstream( msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte8_t csn, int fw, int fh, Byte8_t *j2klen) { @@ -246,11 +245,6 @@ Byte_t * recons_codestream_from_JPPstream( msgqueue_param_t *msgqueue, Byte_t *j if( !get_mainheader_from_j2kstream( j2kstream, &SIZ, &COD)) return j2kstream; - if( COD.prog_order != RPCL){ - fprintf( FCGI_stderr, "Error, Only RPCL order supported\n"); - return j2kstream; - } - if( fw == 0 || fh == 0) mindeclev = 0; else @@ -276,17 +270,17 @@ Byte_t * recons_codestream_from_JPPstream( msgqueue_param_t *msgqueue, Byte_t *j } if( foundTH){ - j2kstream = recons_RPCLbitstream( msgqueue, jpipstream, j2kstream, csn, tileID, SIZ, COD, mindeclev, &max_reslev, j2klen); + j2kstream = recons_bitstream( msgqueue, jpipstream, j2kstream, csn, tileID, SIZ, COD, mindeclev, &max_reslev, j2klen); modify_tileheader( j2kstream, SOToffset, (max_reslevfirst; - binOffset = 0; - foundPrec = false; - while(( ptr = search_message( PRECINCT_MSG, precID, csn, ptr))!=NULL){ - if( ptr->bin_offset == binOffset){ - j2kstream = add_msgstream( ptr, jpipstream, j2kstream, j2klen); - - foundPrec = true; - binOffset += ptr->length; - if( *max_reslev < r) - *max_reslev = r; - } - ptr = ptr->next; - } - if(!foundPrec && COD.Scod & 0x01) - j2kstream = add_padding( 1, j2kstream, j2klen); - } + if( COD.Scod & 0x01){ + min_numOfprcts = 0; + for( r=0; rfirst; + binOffset = 0; + foundPrec = false; + l = 0; + + while(( ptr = search_message( PRECINCT_MSG, precID, csn, ptr))!=NULL){ + if( ptr->bin_offset == binOffset){ + if( lay_idx == l){ + j2kstream = add_msgstream( ptr, jpipstream, j2kstream, j2klen); + foundPrec = true; + if( *max_reslev < res_idx) + *max_reslev = res_idx; + + break; + } + binOffset += ptr->length; + l++; + } + ptr = ptr->next; + } + if( !foundPrec && COD.Scod & 0x01) + j2kstream = add_padding( 1, j2kstream, j2klen); + + return j2kstream; +} + + +Byte_t * recons_precinct( msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte_t *j2kstream, Byte8_t csn, + Byte8_t tileID, SIZmarker_param_t SIZ, CODmarker_param_t COD, int *max_reslev, + int comp_idx, int res_idx, Byte8_t seqID, Byte8_t *j2klen) +{ + Byte8_t precID, binOffset; + message_param_t *ptr; + bool foundPrec; + + precID = comp_precinct_id( tileID, comp_idx, seqID, SIZ.Csiz, SIZ.XTnum*SIZ.YTnum); + + ptr = msgqueue->first; + binOffset = 0; + foundPrec = false; + + while(( ptr = search_message( PRECINCT_MSG, precID, csn, ptr))!=NULL){ + if( ptr->bin_offset == binOffset){ + j2kstream = add_msgstream( ptr, jpipstream, j2kstream, j2klen); + + foundPrec = true; + binOffset += ptr->length; + if( *max_reslev < res_idx) + *max_reslev = res_idx; + + if( ptr->last_byte) + break; + } + ptr = ptr->next; + } + if(!foundPrec && COD.Scod & 0x01) + j2kstream = add_padding( COD.numOflayers, j2kstream, j2klen); + + return j2kstream; +} + +Byte8_t comp_seqID( Byte8_t tileID, SIZmarker_param_t SIZ, CODmarker_param_t COD, int r, int p) +{ + Byte8_t seqID = 0; + int rr; + + for( rr=0; rrfirst->csn, 0, 0, &j2klen); delete_msgqueue( &msgqueue);