Merge "camera2: Update mandatory streams for ultra high resolution sensors." into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
f9158d2217
@@ -345,20 +345,14 @@ public final class MandatoryStreamCombination {
|
||||
public int mFormat;
|
||||
public SizeThreshold mSizeThreshold;
|
||||
public boolean mIsInput;
|
||||
public boolean mIsUltraHighResolution;
|
||||
public StreamTemplate(int format, SizeThreshold sizeThreshold) {
|
||||
this(format, sizeThreshold, /*isInput*/false, /*ultraHighResolution*/false);
|
||||
this(format, sizeThreshold, /*isInput*/false);
|
||||
}
|
||||
public StreamTemplate(@Format int format, @NonNull SizeThreshold sizeThreshold,
|
||||
boolean isInput) {
|
||||
this(format, sizeThreshold, isInput, /*ultraHighResolution*/ false);
|
||||
}
|
||||
public StreamTemplate(@Format int format, @NonNull SizeThreshold sizeThreshold,
|
||||
boolean isInput, boolean isUltraHighResolution) {
|
||||
mFormat = format;
|
||||
mSizeThreshold = sizeThreshold;
|
||||
mIsInput = isInput;
|
||||
mIsUltraHighResolution = isUltraHighResolution;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -366,6 +360,8 @@ public final class MandatoryStreamCombination {
|
||||
public StreamTemplate[] mStreamTemplates;
|
||||
public String mDescription;
|
||||
public ReprocessType mReprocessType;
|
||||
// Substitute MAXIMUM size YUV output stream with JPEG / RAW_SENSOR.
|
||||
public boolean mSubstituteYUV = false;
|
||||
|
||||
public StreamCombinationTemplate(@NonNull StreamTemplate[] streamTemplates,
|
||||
@NonNull String description) {
|
||||
@@ -373,11 +369,22 @@ public final class MandatoryStreamCombination {
|
||||
}
|
||||
|
||||
public StreamCombinationTemplate(@NonNull StreamTemplate[] streamTemplates,
|
||||
@NonNull String description,
|
||||
ReprocessType reprocessType) {
|
||||
@NonNull String description, ReprocessType reprocessType) {
|
||||
this(streamTemplates, description, reprocessType, /*substituteYUV*/ false);
|
||||
}
|
||||
|
||||
public StreamCombinationTemplate(@NonNull StreamTemplate[] streamTemplates,
|
||||
@NonNull String description, boolean substituteYUV) {
|
||||
this(streamTemplates, description, /*reprocessType*/ ReprocessType.NONE,
|
||||
substituteYUV);
|
||||
}
|
||||
|
||||
public StreamCombinationTemplate(@NonNull StreamTemplate[] streamTemplates,
|
||||
@NonNull String description, ReprocessType reprocessType, boolean substituteYUV) {
|
||||
mStreamTemplates = streamTemplates;
|
||||
mReprocessType = reprocessType;
|
||||
mDescription = description;
|
||||
mSubstituteYUV = substituteYUV;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -769,15 +776,160 @@ public final class MandatoryStreamCombination {
|
||||
};
|
||||
|
||||
private static StreamCombinationTemplate sUltraHighResolutionStreamCombinations[] = {
|
||||
// UH res YUV / RAW / JPEG + PRIV preview size stream
|
||||
new StreamCombinationTemplate(new StreamTemplate [] {
|
||||
new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.FULL_RES) },
|
||||
"Full res YUV image capture"),
|
||||
new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.FULL_RES),
|
||||
new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.PREVIEW)},
|
||||
"Ultra high resolution YUV image capture with preview"),
|
||||
new StreamCombinationTemplate(new StreamTemplate [] {
|
||||
new StreamTemplate(ImageFormat.RAW_SENSOR, SizeThreshold.FULL_RES) },
|
||||
"Full res RAW capture"),
|
||||
new StreamTemplate(ImageFormat.RAW_SENSOR, SizeThreshold.FULL_RES),
|
||||
new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.PREVIEW)},
|
||||
"Ultra high resolution RAW_SENSOR image capture with preview"),
|
||||
new StreamCombinationTemplate(new StreamTemplate [] {
|
||||
new StreamTemplate(ImageFormat.JPEG, SizeThreshold.FULL_RES) },
|
||||
"Full res JPEG still image capture"),
|
||||
new StreamTemplate(ImageFormat.JPEG, SizeThreshold.FULL_RES),
|
||||
new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.PREVIEW)},
|
||||
"Ultra high resolution JPEG image capture with preview"),
|
||||
|
||||
// UH res YUV / RAW / JPEG + YUV preview size stream
|
||||
new StreamCombinationTemplate(new StreamTemplate [] {
|
||||
new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.FULL_RES),
|
||||
new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.PREVIEW)},
|
||||
"No-viewfinder Ultra high resolution YUV image capture with image analysis"),
|
||||
new StreamCombinationTemplate(new StreamTemplate [] {
|
||||
new StreamTemplate(ImageFormat.RAW_SENSOR, SizeThreshold.FULL_RES),
|
||||
new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.PREVIEW)},
|
||||
"No-viewfinder Ultra high resolution RAW_SENSOR image capture with image analysis"),
|
||||
new StreamCombinationTemplate(new StreamTemplate [] {
|
||||
new StreamTemplate(ImageFormat.JPEG, SizeThreshold.FULL_RES),
|
||||
new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.PREVIEW)},
|
||||
"No-viewfinder Ultra high resolution JPEG image capture with image analysis"),
|
||||
|
||||
// UH res YUV / RAW / JPEG + PRIV preview + PRIV RECORD stream
|
||||
new StreamCombinationTemplate(new StreamTemplate [] {
|
||||
new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.FULL_RES),
|
||||
new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.PREVIEW),
|
||||
new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.RECORD)},
|
||||
"Ultra high resolution YUV image capture with preview + app-based image analysis"),
|
||||
new StreamCombinationTemplate(new StreamTemplate [] {
|
||||
new StreamTemplate(ImageFormat.RAW_SENSOR, SizeThreshold.FULL_RES),
|
||||
new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.PREVIEW),
|
||||
new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.RECORD)},
|
||||
"Ultra high resolution RAW image capture with preview + app-based image analysis"),
|
||||
new StreamCombinationTemplate(new StreamTemplate [] {
|
||||
new StreamTemplate(ImageFormat.JPEG, SizeThreshold.FULL_RES),
|
||||
new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.PREVIEW),
|
||||
new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.RECORD)},
|
||||
"Ultra high resolution JPEG image capture with preview + app-based image analysis"),
|
||||
|
||||
// UH res YUV / RAW / JPEG + PRIV preview + YUV RECORD stream
|
||||
new StreamCombinationTemplate(new StreamTemplate [] {
|
||||
new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.FULL_RES),
|
||||
new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.PREVIEW),
|
||||
new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.RECORD)},
|
||||
"Ultra high resolution YUV image capture with preview + app-based image analysis"),
|
||||
new StreamCombinationTemplate(new StreamTemplate [] {
|
||||
new StreamTemplate(ImageFormat.RAW_SENSOR, SizeThreshold.FULL_RES),
|
||||
new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.PREVIEW),
|
||||
new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.RECORD)},
|
||||
"Ultra high resolution RAW image capture with preview + app-based image analysis"),
|
||||
new StreamCombinationTemplate(new StreamTemplate [] {
|
||||
new StreamTemplate(ImageFormat.JPEG, SizeThreshold.FULL_RES),
|
||||
new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.PREVIEW),
|
||||
new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.RECORD)},
|
||||
"Ultra high resolution JPEG image capture with preview + app-based image analysis"),
|
||||
|
||||
// UH RES YUV / RAW / JPEG + PRIV preview + YUV / RAW / JPEG Maximum stream
|
||||
new StreamCombinationTemplate(new StreamTemplate [] {
|
||||
new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.FULL_RES),
|
||||
new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.PREVIEW),
|
||||
new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.MAXIMUM)},
|
||||
"Ultra high resolution YUV image capture with preview + default",
|
||||
/*substituteYUV*/ true),
|
||||
new StreamCombinationTemplate(new StreamTemplate [] {
|
||||
new StreamTemplate(ImageFormat.RAW_SENSOR, SizeThreshold.FULL_RES),
|
||||
new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.PREVIEW),
|
||||
new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.MAXIMUM)},
|
||||
"Ultra high resolution RAW image capture with preview + default",
|
||||
/*substituteYUV*/ true),
|
||||
new StreamCombinationTemplate(new StreamTemplate [] {
|
||||
new StreamTemplate(ImageFormat.JPEG, SizeThreshold.FULL_RES),
|
||||
new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.PREVIEW),
|
||||
new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.MAXIMUM)},
|
||||
"Ultra high resolution JPEG capture with preview + default",
|
||||
/*substituteYUV*/ true),
|
||||
};
|
||||
|
||||
private static StreamCombinationTemplate sUltraHighResolutionReprocStreamCombinations[] = {
|
||||
// RAW_SENSOR -> RAW_SENSOR + preview size PRIV / YUV
|
||||
new StreamCombinationTemplate(new StreamTemplate [] {
|
||||
new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.PREVIEW)},
|
||||
"In-app RAW remosaic reprocessing with separate preview",
|
||||
/*reprocessType*/ ReprocessType.REMOSAIC),
|
||||
new StreamCombinationTemplate(new StreamTemplate [] {
|
||||
new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.PREVIEW)},
|
||||
"In-app RAW remosaic reprocessing with in-app image analysis",
|
||||
/*reprocessType*/ ReprocessType.REMOSAIC),
|
||||
|
||||
// RAW -> JPEG / YUV reprocessing + YUV / PRIV preview size stream
|
||||
new StreamCombinationTemplate(new StreamTemplate [] {
|
||||
new StreamTemplate(ImageFormat.JPEG, SizeThreshold.FULL_RES),
|
||||
new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.PREVIEW)},
|
||||
"In-app RAW -> JPEG reprocessing with separate preview",
|
||||
/*reprocessType*/ ReprocessType.REMOSAIC),
|
||||
new StreamCombinationTemplate(new StreamTemplate [] {
|
||||
new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.FULL_RES),
|
||||
new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.PREVIEW)},
|
||||
"In-app RAW -> YUV reprocessing with separate preview",
|
||||
/*reprocessType*/ ReprocessType.REMOSAIC),
|
||||
new StreamCombinationTemplate(new StreamTemplate [] {
|
||||
new StreamTemplate(ImageFormat.JPEG, SizeThreshold.FULL_RES),
|
||||
new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.PREVIEW)},
|
||||
"In-app RAW -> JPEG reprocessing with in-app image analysis",
|
||||
/*reprocessType*/ ReprocessType.REMOSAIC),
|
||||
new StreamCombinationTemplate(new StreamTemplate [] {
|
||||
new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.FULL_RES),
|
||||
new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.PREVIEW)},
|
||||
"In-app RAW -> YUV reprocessing with in-app image analysis",
|
||||
/*reprocessType*/ ReprocessType.REMOSAIC),
|
||||
};
|
||||
|
||||
private static StreamCombinationTemplate sUltraHighResolutionYUVReprocStreamCombinations[] = {
|
||||
// YUV -> JPEG reprocess + PRIV / YUV preview size stream
|
||||
new StreamCombinationTemplate(new StreamTemplate [] {
|
||||
new StreamTemplate(ImageFormat.JPEG, SizeThreshold.FULL_RES),
|
||||
new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.PREVIEW)},
|
||||
"Ultra high resolution YUV -> JPEG reprocessing with separate preview",
|
||||
/*reprocessType*/ ReprocessType.YUV),
|
||||
new StreamCombinationTemplate(new StreamTemplate [] {
|
||||
new StreamTemplate(ImageFormat.JPEG, SizeThreshold.FULL_RES),
|
||||
new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.PREVIEW)},
|
||||
"Ultra high resolution YUV -> JPEG reprocessing with in-app image analysis",
|
||||
/*reprocessType*/ ReprocessType.YUV),
|
||||
|
||||
// YUV -> YUV reprocess + PRIV / YUV preview size stream
|
||||
new StreamCombinationTemplate(new StreamTemplate [] {
|
||||
new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.FULL_RES),
|
||||
new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.PREVIEW)},
|
||||
"Ultra high resolution YUV -> YUV reprocessing with separate preview",
|
||||
/*reprocessType*/ ReprocessType.YUV),
|
||||
new StreamCombinationTemplate(new StreamTemplate [] {
|
||||
new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.FULL_RES),
|
||||
new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.PREVIEW)},
|
||||
"Ultra high resolution YUV -> YUV reprocessing with in-app image analysis",
|
||||
/*reprocessType*/ ReprocessType.YUV),
|
||||
};
|
||||
|
||||
private static StreamCombinationTemplate sUltraHighResolutionPRIVReprocStreamCombinations[] = {
|
||||
new StreamCombinationTemplate(new StreamTemplate [] {
|
||||
new StreamTemplate(ImageFormat.JPEG, SizeThreshold.FULL_RES),
|
||||
new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.PREVIEW)},
|
||||
"Ultra high resolution PRIVATE -> JPEG reprocessing with separate preview",
|
||||
/*reprocessType*/ ReprocessType.PRIVATE),
|
||||
new StreamCombinationTemplate(new StreamTemplate [] {
|
||||
new StreamTemplate(ImageFormat.JPEG, SizeThreshold.FULL_RES),
|
||||
new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.PREVIEW)},
|
||||
"Ultra high resolution PRIVATE -> JPEG reprocessing with in-app image analysis",
|
||||
/*reprocessType*/ ReprocessType.PRIVATE),
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -903,86 +1055,183 @@ public final class MandatoryStreamCombination {
|
||||
public @NonNull List<MandatoryStreamCombination>
|
||||
getAvailableMandatoryMaximumResolutionStreamCombinations() {
|
||||
|
||||
ArrayList<StreamCombinationTemplate> chosenStreamCombinations =
|
||||
if (!isColorOutputSupported()) {
|
||||
Log.v(TAG, "Device is not backward compatible!, no mandatory maximum res streams");
|
||||
return null;
|
||||
}
|
||||
|
||||
ArrayList<StreamCombinationTemplate> chosenStreamCombinationTemplates =
|
||||
new ArrayList<StreamCombinationTemplate>();
|
||||
|
||||
chosenStreamCombinations.addAll(Arrays.asList(sUltraHighResolutionStreamCombinations));
|
||||
chosenStreamCombinationTemplates.addAll(
|
||||
Arrays.asList(sUltraHighResolutionStreamCombinations));
|
||||
|
||||
ArrayList<MandatoryStreamCombination> availableStreamCombinations =
|
||||
new ArrayList<MandatoryStreamCombination>();
|
||||
boolean addRemosaicReprocessing = isRemosaicReprocessingSupported();
|
||||
|
||||
int remosaicSize = 0;
|
||||
Size [] maxResYUVInputSizes =
|
||||
mStreamConfigMapMaximumResolution.getInputSizes(ImageFormat.YUV_420_888);
|
||||
Size [] maxResPRIVInputSizes =
|
||||
mStreamConfigMapMaximumResolution.getInputSizes(ImageFormat.PRIVATE);
|
||||
|
||||
if (addRemosaicReprocessing) {
|
||||
remosaicSize = 1;
|
||||
remosaicSize += sUltraHighResolutionReprocStreamCombinations.length;
|
||||
chosenStreamCombinationTemplates.addAll(
|
||||
Arrays.asList(sUltraHighResolutionReprocStreamCombinations));
|
||||
}
|
||||
|
||||
if (maxResYUVInputSizes != null && maxResYUVInputSizes.length != 0) {
|
||||
remosaicSize += sUltraHighResolutionYUVReprocStreamCombinations.length;
|
||||
chosenStreamCombinationTemplates.addAll(
|
||||
Arrays.asList(sUltraHighResolutionYUVReprocStreamCombinations));
|
||||
}
|
||||
|
||||
if (maxResPRIVInputSizes != null && maxResPRIVInputSizes.length != 0) {
|
||||
remosaicSize += sUltraHighResolutionPRIVReprocStreamCombinations.length;
|
||||
chosenStreamCombinationTemplates.addAll(
|
||||
Arrays.asList(sUltraHighResolutionPRIVReprocStreamCombinations));
|
||||
|
||||
}
|
||||
availableStreamCombinations.ensureCapacity(
|
||||
chosenStreamCombinations.size() + remosaicSize);
|
||||
fillMandatoryOutputStreamCombinations(availableStreamCombinations,
|
||||
chosenStreamCombinations, mStreamConfigMapMaximumResolution);
|
||||
if (isRemosaicReprocessingSupported()) {
|
||||
// Add reprocess mandatory streams
|
||||
ArrayList<MandatoryStreamInformation> streamsInfo =
|
||||
new ArrayList<MandatoryStreamInformation>();
|
||||
chosenStreamCombinationTemplates.size() + remosaicSize);
|
||||
fillUHMandatoryStreamCombinations(availableStreamCombinations,
|
||||
chosenStreamCombinationTemplates);
|
||||
|
||||
ArrayList<Size> inputSize = new ArrayList<Size>();
|
||||
Size maxRawInputSize = getMaxSize(mStreamConfigMapMaximumResolution.getInputSizes(
|
||||
ImageFormat.RAW_SENSOR));
|
||||
inputSize.add(maxRawInputSize);
|
||||
|
||||
streamsInfo.add(new MandatoryStreamInformation(inputSize,
|
||||
ImageFormat.RAW_SENSOR, /*isMaximumSize*/true, /*isInput*/true,
|
||||
/*ultraHighResolution*/true));
|
||||
streamsInfo.add(new MandatoryStreamInformation(inputSize,
|
||||
ImageFormat.RAW_SENSOR, /*isMaximumSize*/true, /*isInput*/ false,
|
||||
/*ultraHighResolution*/true));
|
||||
MandatoryStreamCombination streamCombination;
|
||||
streamCombination = new MandatoryStreamCombination(streamsInfo,
|
||||
"Remosaic reprocessing", /*isReprocess*/true);
|
||||
availableStreamCombinations.add(streamCombination);
|
||||
}
|
||||
return Collections.unmodifiableList(availableStreamCombinations);
|
||||
}
|
||||
|
||||
private void fillMandatoryOutputStreamCombinations(
|
||||
ArrayList<MandatoryStreamCombination> availableStreamCombinations,
|
||||
ArrayList<StreamCombinationTemplate> chosenStreamCombinations,
|
||||
StreamConfigurationMap streamConfigMap) {
|
||||
private MandatoryStreamCombination createUHSensorMandatoryStreamCombination(
|
||||
StreamCombinationTemplate combTemplate, int substitutedFormat) {
|
||||
ArrayList<MandatoryStreamInformation> streamsInfo =
|
||||
new ArrayList<MandatoryStreamInformation>();
|
||||
streamsInfo.ensureCapacity(combTemplate.mStreamTemplates.length);
|
||||
boolean isReprocess = combTemplate.mReprocessType != ReprocessType.NONE;
|
||||
if (isReprocess) {
|
||||
int format = -1;
|
||||
ArrayList<Size> inputSize = new ArrayList<Size>();
|
||||
if (combTemplate.mReprocessType == ReprocessType.PRIVATE) {
|
||||
inputSize.add(
|
||||
getMaxSize(mStreamConfigMapMaximumResolution.getInputSizes(
|
||||
ImageFormat.PRIVATE)));
|
||||
format = ImageFormat.PRIVATE;
|
||||
} else if (combTemplate.mReprocessType == ReprocessType.REMOSAIC) {
|
||||
inputSize.add(
|
||||
getMaxSize(mStreamConfigMapMaximumResolution.getInputSizes(
|
||||
ImageFormat.RAW_SENSOR)));
|
||||
format = ImageFormat.RAW_SENSOR;
|
||||
} else {
|
||||
inputSize.add(
|
||||
getMaxSize(mStreamConfigMapMaximumResolution.getInputSizes(
|
||||
ImageFormat.YUV_420_888)));
|
||||
format = ImageFormat.YUV_420_888;
|
||||
}
|
||||
streamsInfo.add(new MandatoryStreamInformation(inputSize, format,
|
||||
/*isMaximumSize*/false, /*isInput*/true,
|
||||
/*isUltraHighResolution*/ true));
|
||||
streamsInfo.add(new MandatoryStreamInformation(inputSize, format,
|
||||
/*isMaximumSize*/false, /*isInput*/ false,
|
||||
/*isUltraHighResolution*/true));
|
||||
}
|
||||
HashMap<Pair<SizeThreshold, Integer>, List<Size>> availableDefaultNonRawSizes =
|
||||
enumerateAvailableSizes();
|
||||
if (availableDefaultNonRawSizes == null) {
|
||||
Log.e(TAG, "Available size enumeration failed");
|
||||
return null;
|
||||
}
|
||||
Size[] defaultRawSizes =
|
||||
mStreamConfigMap.getOutputSizes(ImageFormat.RAW_SENSOR);
|
||||
ArrayList<Size> availableDefaultRawSizes = new ArrayList<>();
|
||||
if (defaultRawSizes != null) {
|
||||
availableDefaultRawSizes.ensureCapacity(defaultRawSizes.length);
|
||||
availableDefaultRawSizes.addAll(Arrays.asList(defaultRawSizes));
|
||||
}
|
||||
for (StreamTemplate template : combTemplate.mStreamTemplates) {
|
||||
MandatoryStreamInformation streamInfo;
|
||||
List<Size> sizes = new ArrayList<Size>();
|
||||
int formatChosen = template.mFormat;
|
||||
boolean isUltraHighResolution =
|
||||
(template.mSizeThreshold == SizeThreshold.FULL_RES);
|
||||
StreamConfigurationMap sm =
|
||||
isUltraHighResolution ?
|
||||
mStreamConfigMapMaximumResolution : mStreamConfigMap;
|
||||
boolean isMaximumSize = (template.mSizeThreshold == SizeThreshold.MAXIMUM);
|
||||
|
||||
for (StreamCombinationTemplate combTemplate : chosenStreamCombinations) {
|
||||
ArrayList<MandatoryStreamInformation> streamsInfo =
|
||||
new ArrayList<MandatoryStreamInformation>();
|
||||
streamsInfo.ensureCapacity(combTemplate.mStreamTemplates.length);
|
||||
|
||||
for (StreamTemplate template : combTemplate.mStreamTemplates) {
|
||||
MandatoryStreamInformation streamInfo;
|
||||
List<Size> sizes = new ArrayList<Size>();
|
||||
Size sizeChosen =
|
||||
getMaxSize(streamConfigMap.getOutputSizes(
|
||||
template.mFormat));
|
||||
boolean isMaximumSize = (template.mSizeThreshold == SizeThreshold.MAXIMUM);
|
||||
sizes.add(sizeChosen);
|
||||
try {
|
||||
streamInfo = new MandatoryStreamInformation(sizes, template.mFormat,
|
||||
isMaximumSize, /*isInput*/ false, /*ultraHighResolution*/ true);
|
||||
} catch (IllegalArgumentException e) {
|
||||
String cause = "No available sizes found for format: " + template.mFormat
|
||||
+ " size threshold: " + template.mSizeThreshold + " combination: "
|
||||
+ combTemplate.mDescription;
|
||||
throw new RuntimeException(cause, e);
|
||||
}
|
||||
streamsInfo.add(streamInfo);
|
||||
if (substitutedFormat != ImageFormat.UNKNOWN && isMaximumSize) {
|
||||
formatChosen = substitutedFormat;
|
||||
}
|
||||
|
||||
if (isUltraHighResolution) {
|
||||
sizes.add(getMaxSize(sm.getOutputSizes(formatChosen)));
|
||||
} else {
|
||||
if (formatChosen == ImageFormat.RAW_SENSOR) {
|
||||
// RAW_SENSOR always has MAXIMUM threshold.
|
||||
sizes = availableDefaultRawSizes;
|
||||
} else {
|
||||
Pair<SizeThreshold, Integer> pair =
|
||||
new Pair<SizeThreshold, Integer>(template.mSizeThreshold,
|
||||
new Integer(formatChosen));
|
||||
sizes = availableDefaultNonRawSizes.get(pair);
|
||||
}
|
||||
}
|
||||
|
||||
MandatoryStreamCombination streamCombination;
|
||||
try {
|
||||
streamCombination = new MandatoryStreamCombination(streamsInfo,
|
||||
combTemplate.mDescription, /*isReprocess*/false);
|
||||
streamInfo = new MandatoryStreamInformation(sizes, formatChosen,
|
||||
isMaximumSize, /*isInput*/ false, isUltraHighResolution);
|
||||
} catch (IllegalArgumentException e) {
|
||||
String cause = "No stream information for mandatory combination: "
|
||||
String cause = "No available sizes found for format: " + template.mFormat
|
||||
+ " size threshold: " + template.mSizeThreshold + " combination: "
|
||||
+ combTemplate.mDescription;
|
||||
throw new RuntimeException(cause, e);
|
||||
}
|
||||
streamsInfo.add(streamInfo);
|
||||
}
|
||||
|
||||
String formatString = null;
|
||||
switch (substitutedFormat) {
|
||||
case ImageFormat.RAW_SENSOR :
|
||||
formatString = "RAW_SENSOR";
|
||||
break;
|
||||
case ImageFormat.JPEG :
|
||||
formatString = "JPEG";
|
||||
break;
|
||||
default:
|
||||
formatString = "YUV";
|
||||
}
|
||||
|
||||
MandatoryStreamCombination streamCombination;
|
||||
try {
|
||||
streamCombination = new MandatoryStreamCombination(streamsInfo,
|
||||
combTemplate.mDescription + " " + formatString + " still-capture",
|
||||
isReprocess);
|
||||
} catch (IllegalArgumentException e) {
|
||||
String cause = "No stream information for mandatory combination: "
|
||||
+ combTemplate.mDescription;
|
||||
throw new RuntimeException(cause, e);
|
||||
}
|
||||
return streamCombination;
|
||||
}
|
||||
|
||||
private void fillUHMandatoryStreamCombinations(
|
||||
ArrayList<MandatoryStreamCombination> availableStreamCombinations,
|
||||
ArrayList<StreamCombinationTemplate> chosenTemplates) {
|
||||
|
||||
for (StreamCombinationTemplate combTemplate : chosenTemplates) {
|
||||
MandatoryStreamCombination streamCombination =
|
||||
createUHSensorMandatoryStreamCombination(combTemplate,
|
||||
ImageFormat.UNKNOWN);
|
||||
availableStreamCombinations.add(streamCombination);
|
||||
if (combTemplate.mSubstituteYUV) {
|
||||
streamCombination =
|
||||
createUHSensorMandatoryStreamCombination(combTemplate,
|
||||
ImageFormat.RAW_SENSOR);
|
||||
availableStreamCombinations.add(streamCombination);
|
||||
streamCombination =
|
||||
createUHSensorMandatoryStreamCombination(combTemplate,
|
||||
ImageFormat.JPEG);
|
||||
availableStreamCombinations.add(streamCombination);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1135,6 +1384,7 @@ public final class MandatoryStreamCombination {
|
||||
inputSize.add(maxPrivateInputSize);
|
||||
format = ImageFormat.PRIVATE;
|
||||
} else {
|
||||
// Default mandatory streams only have PRIVATE / YUV reprocessing.
|
||||
inputSize.add(maxYUVInputSize);
|
||||
format = ImageFormat.YUV_420_888;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user