| 181 | FastJPEG j2 = new FastJPEG(); |
| 182 | |
| 183 | private Callable<Pair<ByteBuffer, ByteBuffer>> makeWorker(final Pair<ByteBuffer, ByteBuffer> storage, final String filename) { |
| 184 | return new Callable<Pair<ByteBuffer, ByteBuffer>>() { |
| 185 | public Pair<ByteBuffer, ByteBuffer> call() throws Exception { |
| 186 | |
| 187 | for(int y=0;y<height;y++) |
| 188 | { |
| 189 | storage.first.position(y*width*3); |
| 190 | storage.first.limit((y+1)*width*3); |
| 191 | storage.second.position((height-y-1)*width*3); |
| 192 | storage.second.limit((height-y-1+1)*width*3); |
| 193 | storage.second.put(storage.first); |
| 194 | storage.second.clear(); |
| 195 | storage.first.clear(); |
| 196 | } |
| 197 | |
| 198 | try { |
| 199 | |
| 200 | |
| 201 | // j2.compress(filename, storage.second, width, height); |
| 202 | System.out.println(" -- slow save --"); |
| 203 | new SlowJPEG().compress(filename, storage.second, width, height); |
| 204 | } catch (Throwable t) { |
| 205 | System.err.println(" -- exception thrown in compress for :" + filename + " " + storage + " " + width + " " + height); |
| 206 | t.printStackTrace(); |
| 207 | } |
| 208 | return storage; |
| 209 | |
| 210 | } |
| 211 | }; |