jl777 7 years ago
parent
commit
79176ef6cc
  1. 13
      iguana/exchanges/LP_privkey.c

13
iguana/exchanges/LP_privkey.c

@ -483,12 +483,13 @@ int32_t LP_jpg_process(int32_t *capacityp,char *inputfname,char *outputfname,uin
{ {
val = row_ptrs[compnum][0][blocknum][i]; val = row_ptrs[compnum][0][blocknum][i];
//if ( val < -8 || val > 8 ) //if ( val < -8 || val > 8 )
if ( val >= 0 && val < 2 ) if ( val == 0 || val == 1 )
{ {
if ( (*capacityp) < required ) if ( (*capacityp) < required )
{ {
if ( (val & 1) != 0 ) if ( (val & 1) != 0 )
decoded[(*capacityp) >> 3] |= (1 << ((*capacityp)&7)); decoded[(*capacityp) >> 3] |= (1 << ((*capacityp)&7));
printf("%c",(val&1)!=0?'1':'0');
} }
(*capacityp)++; (*capacityp)++;
} }
@ -497,7 +498,7 @@ int32_t LP_jpg_process(int32_t *capacityp,char *inputfname,char *outputfname,uin
} }
} }
} }
printf("capacity %d required.%d power2.%d limit.%d\n",*capacityp,required,power2,limit); printf(" capacity %d required.%d power2.%d limit.%d\n",*capacityp,required,power2,limit);
if ( *capacityp > required && outputfname != 0 && outputfname[0] != 0 ) if ( *capacityp > required && outputfname != 0 && outputfname[0] != 0 )
{ {
if ((output_file = fopen(outputfname, WRITE_BINARY)) == NULL) { if ((output_file = fopen(outputfname, WRITE_BINARY)) == NULL) {
@ -520,12 +521,13 @@ int32_t LP_jpg_process(int32_t *capacityp,char *inputfname,char *outputfname,uin
{ {
val = coef_buffers[compnum][rownum][blocknum][i]; val = coef_buffers[compnum][rownum][blocknum][i];
//if ( val < -8 || val > 8 ) //if ( val < -8 || val > 8 )
if ( val >= 0 && val < 2 ) if ( val == 0 || val == 1 )
{ {
val &= ~1; val &= ~1;
if ( (emit < required && (data[emit >> 3] & (1 << (emit&7))) != 0) || (rand() & 1) != 0 ) if ( (emit < required && (data[emit >> 3] & (1 << (emit&7))) != 0) || (rand() & 1) != 0 )
val |= 1; val |= 1;
emit++; emit++;
printf("%c",(val&1)!=0?'1':'0');
} }
coef_buffers[compnum][rownum][blocknum][i] = val; coef_buffers[compnum][rownum][blocknum][i] = val;
//printf("%i,", coef_buffers[compnum][rownum][blocknum][i]); //printf("%i,", coef_buffers[compnum][rownum][blocknum][i]);
@ -533,9 +535,8 @@ int32_t LP_jpg_process(int32_t *capacityp,char *inputfname,char *outputfname,uin
} }
} }
} }
//printf("\n\n"); printf(" emit.%d\n",emit);
// Output the new DCT coeffs to a JPEG file
/* Output the new DCT coeffs to a JPEG file */
modified = 0; modified = 0;
for (compnum=0; compnum<num_components; compnum++) for (compnum=0; compnum<num_components; compnum++)
{ {

Loading…
Cancel
Save