你好这里的开发者。
最近我修改了 ColorOS Camera 的一个端口,使其可以在我的设备(小米 Mi4)上运行。实际上,这个应用程序仅适用于 XML 版本。但要解决的是这个应用程序使用默认的android jpeg压缩(在我的例子中jpegquality = 85%)
我刚决定修改 smali 文件来改变这一点。我已经修改了突发模式以捕获 100% 质量的 jpeg(将值 0x4B 更改为 0x64 以获得 100% 质量,而不是在突发模式下为 75% 并且它有效)当我尝试编辑其他行以获得 jpeg 质量 = 100% 时出现问题使用普通拍摄模式。
有人可以帮我解释一下吗?(请不要忘记我是一个初学者,我花了很多时间来尝试编辑)
这是 smali 代码(来自 CameraProcessManager.smali)
.method public setCaptureJpegOrientationAndQuality(I)V
.locals 4
.param p1, "orientation" # I
.prologue
.line 1338
iput p1, p0, Lcom/oppo/camera/CameraProcessManager;->mJpegRotation:I
.line 1339
iget-boolean v1, p0, Lcom/oppo/camera/CameraProcessManager;->mbBurstShot:Z
if-eqz v1, :cond_0
.line 1340
const/16 v0, 0x64
.line 1345
.local v0, "jpegQuality":I
:goto_0
iget-object v1, p0, Lcom/oppo/camera/CameraProcessManager;->mParameterManager:Lcom/oppo/camera/ParameterManager;
iget v2, p0, Lcom/oppo/camera/CameraProcessManager;->mJpegRotation:I
invoke-virtual {v1, v2}, Lcom/oppo/camera/ParameterManager;->setRotation(I)V
.line 1346
iget-object v1, p0, Lcom/oppo/camera/CameraProcessManager;->mParameterManager:Lcom/oppo/camera/ParameterManager;
invoke-virtual {v1, v0}, Lcom/oppo/camera/ParameterManager;->setJpegQuality(I)V
.line 1347
const-string v1, "CameraProcessManager"
new-instance v2, Ljava/lang/StringBuilder;
invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V
const-string v3, "setCaptureJpegOrientationAndQuality(),mJpegRotation:"
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v2
iget v3, p0, Lcom/oppo/camera/CameraProcessManager;->mJpegRotation:I
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
move-result-object v2
const-string v3, " jpegQuality:"
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v2
invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
move-result-object v2
invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v2
invoke-static {v1, v2}, Landroid/util/Log;->v(Ljava/lang/String;Ljava/lang/String;)I
.line 1348
return-void
.line 1342
.end local v0 # "jpegQuality":I
:cond_0
iget v1, p0, Lcom/oppo/camera/CameraProcessManager;->mCameraId:I
const/4 v2, 0x2
invoke-static {v1, v2}, Landroid/media/CameraProfile;->getJpegEncodingQualityParameter(II)I
move-result v0
.restart local v0 # "jpegQuality":I
goto :goto_0
.end method
这是相应的 java 代码(我知道我无法编辑由 smali 制作的 java 代码,遗憾的是,这会更容易)来自 dex2jar :
public void setCaptureJpegOrientationAndQuality(int paramInt)
{
this.mJpegRotation = paramInt;
if (this.mbBurstShot) {}
for (paramInt = 75;; paramInt = CameraProfile.getJpegEncodingQualityParameter(this.mCameraId, 2))
{
this.mParameterManager.setRotation(this.mJpegRotation);
this.mParameterManager.setJpegQuality(paramInt);
Log.v("CameraProcessManager", "setCaptureJpegOrientationAndQuality(),mJpegRotation:" + this.mJpegRotation + " jpegQuality:" + paramInt);
return;
}
}
这是德十工作室的另一个观点:
public void setCaptureJpegOrientationAndQuality(int i)
{
mJpegRotation = i;
int j;
if (mbBurstShot)
j = 100;
else
j = CameraProfile.getJpegEncodingQualityParameter(mCameraId, 2);
mParameterManager.setRotation(mJpegRotation);
mParameterManager.setJpegQuality(j);
Log.v("CameraProcessManager", (new StringBuilder()).append("setCaptureJpegOrientationAndQuality(),mJpegRotation:").append(mJpegRotation).append(" jpegQuality:").append(j).toString());
}
我想保留 jpegorentation 设置,但将 jpegquality 更改为始终为 100%
如果有人能够帮助我并给出一些解释,请提前非常感谢=)