Merge "camera2: Update mandatory streams for ultra high resolution sensors." into sc-dev

This commit is contained in:
Jayant Chowdhary
2021-07-03 05:35:54 +00:00
committed by Android (Google) Code Review

View File

@@ -345,20 +345,14 @@ public final class MandatoryStreamCombination {
public int mFormat; public int mFormat;
public SizeThreshold mSizeThreshold; public SizeThreshold mSizeThreshold;
public boolean mIsInput; public boolean mIsInput;
public boolean mIsUltraHighResolution;
public StreamTemplate(int format, SizeThreshold sizeThreshold) { 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, public StreamTemplate(@Format int format, @NonNull SizeThreshold sizeThreshold,
boolean isInput) { boolean isInput) {
this(format, sizeThreshold, isInput, /*ultraHighResolution*/ false);
}
public StreamTemplate(@Format int format, @NonNull SizeThreshold sizeThreshold,
boolean isInput, boolean isUltraHighResolution) {
mFormat = format; mFormat = format;
mSizeThreshold = sizeThreshold; mSizeThreshold = sizeThreshold;
mIsInput = isInput; mIsInput = isInput;
mIsUltraHighResolution = isUltraHighResolution;
} }
} }
@@ -366,6 +360,8 @@ public final class MandatoryStreamCombination {
public StreamTemplate[] mStreamTemplates; public StreamTemplate[] mStreamTemplates;
public String mDescription; public String mDescription;
public ReprocessType mReprocessType; public ReprocessType mReprocessType;
// Substitute MAXIMUM size YUV output stream with JPEG / RAW_SENSOR.
public boolean mSubstituteYUV = false;
public StreamCombinationTemplate(@NonNull StreamTemplate[] streamTemplates, public StreamCombinationTemplate(@NonNull StreamTemplate[] streamTemplates,
@NonNull String description) { @NonNull String description) {
@@ -373,11 +369,22 @@ public final class MandatoryStreamCombination {
} }
public StreamCombinationTemplate(@NonNull StreamTemplate[] streamTemplates, public StreamCombinationTemplate(@NonNull StreamTemplate[] streamTemplates,
@NonNull String description, @NonNull String description, ReprocessType reprocessType) {
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; mStreamTemplates = streamTemplates;
mReprocessType = reprocessType; mReprocessType = reprocessType;
mDescription = description; mDescription = description;
mSubstituteYUV = substituteYUV;
} }
} }
@@ -769,15 +776,160 @@ public final class MandatoryStreamCombination {
}; };
private static StreamCombinationTemplate sUltraHighResolutionStreamCombinations[] = { private static StreamCombinationTemplate sUltraHighResolutionStreamCombinations[] = {
// UH res YUV / RAW / JPEG + PRIV preview size stream
new StreamCombinationTemplate(new StreamTemplate [] { new StreamCombinationTemplate(new StreamTemplate [] {
new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.FULL_RES) }, new StreamTemplate(ImageFormat.YUV_420_888, SizeThreshold.FULL_RES),
"Full res YUV image capture"), new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.PREVIEW)},
"Ultra high resolution YUV image capture with preview"),
new StreamCombinationTemplate(new StreamTemplate [] { new StreamCombinationTemplate(new StreamTemplate [] {
new StreamTemplate(ImageFormat.RAW_SENSOR, SizeThreshold.FULL_RES) }, new StreamTemplate(ImageFormat.RAW_SENSOR, SizeThreshold.FULL_RES),
"Full res RAW capture"), new StreamTemplate(ImageFormat.PRIVATE, SizeThreshold.PREVIEW)},
"Ultra high resolution RAW_SENSOR image capture with preview"),
new StreamCombinationTemplate(new StreamTemplate [] { new StreamCombinationTemplate(new StreamTemplate [] {
new StreamTemplate(ImageFormat.JPEG, SizeThreshold.FULL_RES) }, new StreamTemplate(ImageFormat.JPEG, SizeThreshold.FULL_RES),
"Full res JPEG still image capture"), 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> public @NonNull List<MandatoryStreamCombination>
getAvailableMandatoryMaximumResolutionStreamCombinations() { 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>(); new ArrayList<StreamCombinationTemplate>();
chosenStreamCombinations.addAll(Arrays.asList(sUltraHighResolutionStreamCombinations)); chosenStreamCombinationTemplates.addAll(
Arrays.asList(sUltraHighResolutionStreamCombinations));
ArrayList<MandatoryStreamCombination> availableStreamCombinations = ArrayList<MandatoryStreamCombination> availableStreamCombinations =
new ArrayList<MandatoryStreamCombination>(); new ArrayList<MandatoryStreamCombination>();
boolean addRemosaicReprocessing = isRemosaicReprocessingSupported(); boolean addRemosaicReprocessing = isRemosaicReprocessingSupported();
int remosaicSize = 0; int remosaicSize = 0;
Size [] maxResYUVInputSizes =
mStreamConfigMapMaximumResolution.getInputSizes(ImageFormat.YUV_420_888);
Size [] maxResPRIVInputSizes =
mStreamConfigMapMaximumResolution.getInputSizes(ImageFormat.PRIVATE);
if (addRemosaicReprocessing) { 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( availableStreamCombinations.ensureCapacity(
chosenStreamCombinations.size() + remosaicSize); chosenStreamCombinationTemplates.size() + remosaicSize);
fillMandatoryOutputStreamCombinations(availableStreamCombinations, fillUHMandatoryStreamCombinations(availableStreamCombinations,
chosenStreamCombinations, mStreamConfigMapMaximumResolution); chosenStreamCombinationTemplates);
if (isRemosaicReprocessingSupported()) {
// Add reprocess mandatory streams
ArrayList<MandatoryStreamInformation> streamsInfo =
new ArrayList<MandatoryStreamInformation>();
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); return Collections.unmodifiableList(availableStreamCombinations);
} }
private void fillMandatoryOutputStreamCombinations( private MandatoryStreamCombination createUHSensorMandatoryStreamCombination(
ArrayList<MandatoryStreamCombination> availableStreamCombinations, StreamCombinationTemplate combTemplate, int substitutedFormat) {
ArrayList<StreamCombinationTemplate> chosenStreamCombinations, ArrayList<MandatoryStreamInformation> streamsInfo =
StreamConfigurationMap streamConfigMap) { 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) { if (substitutedFormat != ImageFormat.UNKNOWN && isMaximumSize) {
ArrayList<MandatoryStreamInformation> streamsInfo = formatChosen = substitutedFormat;
new ArrayList<MandatoryStreamInformation>(); }
streamsInfo.ensureCapacity(combTemplate.mStreamTemplates.length);
if (isUltraHighResolution) {
for (StreamTemplate template : combTemplate.mStreamTemplates) { sizes.add(getMaxSize(sm.getOutputSizes(formatChosen)));
MandatoryStreamInformation streamInfo; } else {
List<Size> sizes = new ArrayList<Size>(); if (formatChosen == ImageFormat.RAW_SENSOR) {
Size sizeChosen = // RAW_SENSOR always has MAXIMUM threshold.
getMaxSize(streamConfigMap.getOutputSizes( sizes = availableDefaultRawSizes;
template.mFormat)); } else {
boolean isMaximumSize = (template.mSizeThreshold == SizeThreshold.MAXIMUM); Pair<SizeThreshold, Integer> pair =
sizes.add(sizeChosen); new Pair<SizeThreshold, Integer>(template.mSizeThreshold,
try { new Integer(formatChosen));
streamInfo = new MandatoryStreamInformation(sizes, template.mFormat, sizes = availableDefaultNonRawSizes.get(pair);
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);
} }
MandatoryStreamCombination streamCombination;
try { try {
streamCombination = new MandatoryStreamCombination(streamsInfo, streamInfo = new MandatoryStreamInformation(sizes, formatChosen,
combTemplate.mDescription, /*isReprocess*/false); isMaximumSize, /*isInput*/ false, isUltraHighResolution);
} catch (IllegalArgumentException e) { } 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; + combTemplate.mDescription;
throw new RuntimeException(cause, e); 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); 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); inputSize.add(maxPrivateInputSize);
format = ImageFormat.PRIVATE; format = ImageFormat.PRIVATE;
} else { } else {
// Default mandatory streams only have PRIVATE / YUV reprocessing.
inputSize.add(maxYUVInputSize); inputSize.add(maxYUVInputSize);
format = ImageFormat.YUV_420_888; format = ImageFormat.YUV_420_888;
} }