This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Arrays; | |
import java.util.concurrent.ExecutorService; | |
import java.util.concurrent.Executors; | |
import java.util.concurrent.ForkJoinPool; | |
import java.util.concurrent.RecursiveAction; | |
import java.util.concurrent.TimeUnit; | |
public class Stealing { | |
private final static int NTHREADS = Runtime.getRuntime().availableProcessors(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package alena.s21; | |
/** | |
* Created by Алена on 17.03.2015. | |
*/ | |
import java.net.ServerSocket; | |
import java.net.Socket; | |
import java.io.IOException; | |
public class MultiThreadedServer implements Runnable{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package alena.s21; | |
/** | |
* Created by Алена on 17.03.2015. | |
*/ | |
import java.io.InputStream; | |
import java.io.OutputStream; | |
import java.io.IOException; | |
import java.net.Socket; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public byte[] blurGauss_1(byte[] originalImage, int w, int h, double r) | |
{ | |
byte[] blurImage = new byte[originalImage.Length]; | |
int rs = (int)Math.Ceiling(r * 2.57); | |
for (int i = 0; i < h; i++) { | |
for (int j = 0; j < w; j++) { | |
double val = 0, wsum = 0; | |
for (int iy = i - rs; iy < i + rs + 1; iy++ ) | |
{ | |
for (int ix = j - rs; ix < j + rs + 1; ix++) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void boxBlur_4(byte[] originalImage, byte[] blurImage, int w, int h, int r) | |
{ | |
for (int i = 0; i < originalImage.Length; i++) | |
{ | |
blurImage[i] = originalImage[i]; | |
} | |
boxBlurH_4(blurImage, originalImage, w, h, r); | |
boxBlurT_4(originalImage, blurImage, w, h, r); | |
} | |
private void boxBlurH_4(byte[] originalImage, byte[] blurImage, int w, int h, int r) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public byte[] blurGauss_2(byte[] originalImage, int w, int h, double r) | |
{ | |
byte[] blurImage = new byte[originalImage.Length]; | |
var bxs = boxesForGauss(r, 3); | |
boxBlur_2(originalImage, blurImage, w, h, (bxs[0] - 1) / 2); | |
boxBlur_2(blurImage, originalImage, w, h, (bxs[1] - 1) / 2); | |
boxBlur_2(originalImage, blurImage, w, h, (bxs[2] - 1) / 2); | |
return blurImage; |