goto_2

PDF动作示例
本文介绍了一个使用iText库创建PDF文档的例子,展示了如何在PDF中实现跳转到本地页面、远程文档的动作。通过设置不同类型的PdfAction,可以实现在文档内部及跨文档之间的导航。
/*
 * $Id: Actions.java,v 1.4 2005/05/09 11:52:44 blowagie Exp $
 * $Name:  $
 *
 * This code is part of the 'iText Tutorial'.
 * You can find the complete tutorial at the following address:
 * http://itextdocs.lowagie.com/tutorial/
 *
 * This code is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * itext-questions@lists.sourceforge.net
 */

package com.lowagie.examples.objects.anchors;

import java.io.FileOutputStream;

import com.lowagie.text.Chunk;
import com.lowagie.text.Document;
import com.lowagie.text.Paragraph;
import com.lowagie.text.pdf.PdfAction;
import com.lowagie.text.pdf.PdfDestination;
import com.lowagie.text.pdf.PdfWriter;

/**
 * Creates a document with some goto actions.
 * 
 * @author blowagie
 */

public class Actions {

	/**
	 * Creates a document with some goto actions.
	 * 
	 * @param args
	 *            no arguments needed
	 */
	public static void main(String[] args) {

		System.out.println("Actions");

		// step 1: creation of a document-object
		Document document = new Document();
		Document remote = new Document();
		try {

			// step 2:
			PdfWriter writer = PdfWriter.getInstance(document,
					new FileOutputStream("Actions.pdf"));
			PdfWriter.getInstance(remote, new FileOutputStream("remote.pdf"));
			// step 3:
			document.open();
			remote.open();
			// step 4: we add some content
			PdfAction action = PdfAction.gotoLocalPage(2, new PdfDestination(
					PdfDestination.XYZ, -1, 10000, 0), writer);
			writer.setOpenAction(action);
			document.add(new Paragraph("Page 1"));
			document.newPage();
			document.add(new Paragraph("Page 2"));
			document.add(new Chunk("goto page 1").setAction(PdfAction
					.gotoLocalPage(1, new PdfDestination(PdfDestination.FITH,
							500), writer)));
			document.add(Chunk.NEWLINE);
			document.add(new Chunk("goto another document").setAction(PdfAction
					.gotoRemotePage("remote.pdf", "test", false, true)));
			remote.add(new Paragraph("Some remote document"));
			remote.newPage();
			Paragraph p = new Paragraph("This paragraph contains a ");
			p.add(new Chunk("local destination").setLocalDestination("test"));
			remote.add(p);
		} catch (Exception de) {
			de.printStackTrace();
		}

		// step 5: we close the document
		document.close();
		remote.close();
	}
}
 
请将以下代码转换为java代码,并保证代码准确无误 .class public Lcom/x/kvm/cl/kvm/Decode; .super Ljava/lang/Object; .source "Decode.java" # annotations .annotation runtime Lcom/x/base/ioc/AnnoBeanAttachToIoc; .end annotation .annotation runtime Lcom/x/base/ioc/AnnoIocBean; beanName = "Decode" .end annotation # static fields .field static final IMG_BIT_USE:I = 0xf .field static final MAX_FILE_LEN:I = 0x800000 .field static final SRC_BUF_LEN:I = 0x63e700 # instance fields .field block_x_num:I .field block_y_num:I .field colorSet:[I .field color_depth:I .field dstBuf:[I .field frame_count:I .field height:I .field index_x:I .field index_y:I .field private ioc:Lcom/x/base/ioc/Ioc; .field len:I .field offset_byte:I .field posTable:[I .field real_height:I .field real_width:I .field slice_x:I .field slice_y:I .field srcBuf:[B .field width:I # direct methods .method public constructor <init>()V .registers 3 const/4 v1, 0x0 .line 46 invoke-direct {p0}, Ljava/lang/Object;-><init>()V .line 23 const/4 v0, 0x0 iput-object v0, p0, Lcom/x/kvm/cl/kvm/Decode;->ioc:Lcom/x/base/ioc/Ioc; .line 41 const/4 v0, 0x2 new-array v0, v0, [I iput-object v0, p0, Lcom/x/kvm/cl/kvm/Decode;->colorSet:[I .line 42 const/16 v0, 0x400 new-array v0, v0, [I iput-object v0, p0, Lcom/x/kvm/cl/kvm/Decode;->posTable:[I .line 44 iput v1, p0, Lcom/x/kvm/cl/kvm/Decode;->slice_x:I .line 45 iput v1, p0, Lcom/x/kvm/cl/kvm/Decode;->slice_y:I .line 48 return-void .end method # virtual methods .method final GETPOS(II)I .registers 5 .param p1, "s" # I .param p2, "i" # I const/4 v0, 0x0 .line 51 if-ltz p2, :cond_7 const/16 v1, 0x3ff if-le p2, v1, :cond_8 .line 55 :cond_7 :goto_7 return v0 :cond_8 iget-object v1, p0, Lcom/x/kvm/cl/kvm/Decode;->posTable:[I aget v1, v1, p2 add-int/2addr v1, p1 if-lez v1, :cond_7 iget-object v0, p0, Lcom/x/kvm/cl/kvm/Decode;->posTable:[I aget v0, v0, p2 add-int/2addr v0, p1 goto :goto_7 .end method .method public curRes()Ljava/awt/Dimension; .registers 4 .line 27 new-instance v0, Ljava/awt/Dimension; iget v1, p0, Lcom/x/kvm/cl/kvm/Decode;->real_width:I iget v2, p0, Lcom/x/kvm/cl/kvm/Decode;->real_height:I invoke-direct {v0, v1, v2}, Ljava/awt/Dimension;-><init>(II)V return-object v0 .end method .method public decode_init(II[B[I)I .registers 10 .param p1, "width" # I .param p2, "height" # I .param p3, "src_buf" # [B .param p4, "dst_buf" # [I const/4 v4, 0x0 .line 611 iput-object p3, p0, Lcom/x/kvm/cl/kvm/Decode;->srcBuf:[B .line 612 iput-object p4, p0, Lcom/x/kvm/cl/kvm/Decode;->dstBuf:[I .line 613 iput p2, p0, Lcom/x/kvm/cl/kvm/Decode;->real_height:I .line 614 iget v2, p0, Lcom/x/kvm/cl/kvm/Decode;->real_height:I rem-int/lit8 v2, v2, 0x20 if-nez v2, :cond_40 .line 615 iget v2, p0, Lcom/x/kvm/cl/kvm/Decode;->real_height:I iput v2, p0, Lcom/x/kvm/cl/kvm/Decode;->height:I .line 620 :goto_11 iput p1, p0, Lcom/x/kvm/cl/kvm/Decode;->real_width:I .line 621 iget v2, p0, Lcom/x/kvm/cl/kvm/Decode;->real_width:I rem-int/lit8 v2, v2, 0x20 if-nez v2, :cond_4b .line 622 iget v2, p0, Lcom/x/kvm/cl/kvm/Decode;->real_width:I iput v2, p0, Lcom/x/kvm/cl/kvm/Decode;->width:I .line 627 :goto_1d iget v2, p0, Lcom/x/kvm/cl/kvm/Decode;->width:I div-int/lit8 v2, v2, 0x20 iput v2, p0, Lcom/x/kvm/cl/kvm/Decode;->block_x_num:I .line 628 iget v2, p0, Lcom/x/kvm/cl/kvm/Decode;->height:I div-int/lit8 v2, v2, 0x20 iput v2, p0, Lcom/x/kvm/cl/kvm/Decode;->block_y_num:I .line 630 iput v4, p0, Lcom/x/kvm/cl/kvm/Decode;->index_x:I .line 631 iput v4, p0, Lcom/x/kvm/cl/kvm/Decode;->index_y:I .line 633 iput v4, p0, Lcom/x/kvm/cl/kvm/Decode;->frame_count:I .line 635 iget-object v2, p0, Lcom/x/kvm/cl/kvm/Decode;->colorSet:[I aput v4, v2, v4 .line 636 iget-object v2, p0, Lcom/x/kvm/cl/kvm/Decode;->colorSet:[I const/4 v3, 0x1 aput v4, v2, v3 .line 638 const/16 v2, 0xf iput v2, p0, Lcom/x/kvm/cl/kvm/Decode;->color_depth:I .line 640 invoke-virtual {p0}, Lcom/x/kvm/cl/kvm/Decode;->init_pos_table()V .line 642 return v4 .line 617 :cond_40 iget v2, p0, Lcom/x/kvm/cl/kvm/Decode;->real_height:I rem-int/lit8 v2, v2, 0x20 rsub-int/lit8 v0, v2, 0x20 .line 618 .local v0, "comp_height":I add-int v2, p2, v0 iput v2, p0, Lcom/x/kvm/cl/kvm/Decode;->height:I goto :goto_11 .line 624 .end local v0 # "comp_height":I :cond_4b iget v2, p0, Lcom/x/kvm/cl/kvm/Decode;->real_width:I rem-int/lit8 v2, v2, 0x20 rsub-int/lit8 v1, v2, 0x20 .line 625 .local v1, "comp_width":I add-int v2, p1, v1 iput v2, p0, Lcom/x/kvm/cl/kvm/Decode;->width:I goto :goto_1d .end method .method decode_single_block(III)I .registers 29 .param p1, "bpos" # I .param p2, "index" # I .param p3, "len" # I .line 61 const/4 v7, 0x0 .line 62 .local v7, "dst_count":I const/4 v8, 0x0 .local v8, "dst_pos":I const/16 v20, 0x0 .line 64 .local v20, "src_pos":I move-object/from16 v0, p0 iget-object v0, v0, Lcom/x/kvm/cl/kvm/Decode;->srcBuf:[B move-object/from16 v19, v0 .line 65 .local v19, "src_buf":[B move-object/from16 v0, p0 iget-object v6, v0, Lcom/x/kvm/cl/kvm/Decode;->dstBuf:[I .line 66 .local v6, "dst_buf":[I move-object/from16 v0, p0 iget-object v5, v0, Lcom/x/kvm/cl/kvm/Decode;->colorSet:[I .line 67 .local v5, "color_set":[I move-object/from16 v0, p0 iget-object v14, v0, Lcom/x/kvm/cl/kvm/Decode;->posTable:[I .line 68 .local v14, "pos_table":[I const/4 v4, 0x0 .line 70 .local v4, "block_dec_err":I :cond_17 :goto_17 const/16 v22, 0x400 move/from16 v0, v22 if-ge v7, v0, :cond_151 move/from16 v0, p2 move/from16 v1, p3 if-ge v0, v1, :cond_151 .line 71 move-object/from16 v0, p0 iget v0, v0, Lcom/x/kvm/cl/kvm/Decode;->offset_byte:I move/from16 v22, v0 add-int v22, v22, p2 const v23, 0x63e700 rem-int v22, v22, v23 aget-byte v21, v19, v22 .line 72 .local v21, "srctmp":B const/16 v22, 0x80 move/from16 v0, v21 and-int/lit16 v0, v0, 0x80 move/from16 v23, v0 move/from16 v0, v22 move/from16 v1, v23 if-ne v0, v1, :cond_f8 .line 74 add-int/lit8 v22, p2, 0x1 move-object/from16 v0, p0 iget v0, v0, Lcom/x/kvm/cl/kvm/Decode;->offset_byte:I move/from16 v23, v0 add-int v22, v22, v23 const v23, 0x63e700 rem-int v22, v22, v23 aget-byte v13, v19, v22 .line 76 .local v13, "nxtsrctmp":I move-object/from16 v0, p0 move/from16 v1, p1 invoke-virtual {v0, v1, v7}, Lcom/x/kvm/cl/kvm/Decode;->GETPOS(II)I move-result v8 .line 78 const/16 v22, 0x8 move-object/from16 v0, p0 iget v0, v0, Lcom/x/kvm/cl/kvm/Decode;->color_depth:I move/from16 v23, v0 move/from16 v0, v22 move/from16 v1, v23 if-ne v0, v1, :cond_b5 .line 82 and-int/lit8 v22, v21, 0x7c shl-int/lit8 v15, v22, 0x1 .line 83 .local v15, "r":I and-int/lit8 v22, v21, 0x3 shl-int/lit8 v22, v22, 0x6 and-int/lit16 v0, v13, 0xe0 move/from16 v23, v0 shr-int/lit8 v23, v23, 0x2 or-int v10, v22, v23 .line 84 .local v10, "g":I and-int/lit8 v22, v13, 0x1f shl-int/lit8 v3, v22, 0x3 .line 102 .local v3, "b":I :goto_7b const/high16 v22, -0x1000000 shl-int/lit8 v23, v15, 0x10 or-int v22, v22, v23 shl-int/lit8 v23, v10, 0x8 or-int v22, v22, v23 or-int v22, v22, v3 aput v22, v6, v8 .line 103 aget v22, v6, v8 const/16 v23, 0x0 aget v23, v5, v23 move/from16 v0, v22 move/from16 v1, v23 if-eq v0, v1, :cond_af aget v22, v6, v8 const/16 v23, 0x1 aget v23, v5, v23 move/from16 v0, v22 move/from16 v1, v23 if-eq v0, v1, :cond_af .line 104 const/16 v22, 0x1 const/16 v23, 0x0 aget v23, v5, v23 aput v23, v5, v22 .line 105 const/16 v22, 0x0 aget v23, v6, v8 aput v23, v5, v22 .line 108 :cond_af add-int/lit8 p2, p2, 0x2 .line 109 add-int/lit8 v7, v7, 0x1 .line 110 goto/16 :goto_17 .line 85 .end local v3 # "b":I .end local v10 # "g":I .end local v15 # "r":I :cond_b5 const/16 v22, 0x4 move-object/from16 v0, p0 iget v0, v0, Lcom/x/kvm/cl/kvm/Decode;->color_depth:I move/from16 v23, v0 move/from16 v0, v22 move/from16 v1, v23 if-ne v0, v1, :cond_d8 .line 87 and-int/lit8 v22, v21, 0x3c shl-int/lit8 v15, v22, 0x2 .line 88 .restart local v15 # "r":I and-int/lit8 v22, v21, 0x1 shl-int/lit8 v22, v22, 0x7 and-int/lit16 v0, v13, 0xe0 move/from16 v23, v0 shr-int/lit8 v23, v23, 0x1 or-int v10, v22, v23 .line 89 .restart local v10 # "g":I and-int/lit8 v22, v13, 0xf shl-int/lit8 v3, v22, 0x4 .restart local v3 # "b":I goto :goto_7b .line 90 .end local v3 # "b":I .end local v10 # "g":I .end local v15 # "r":I :cond_d8 const/16 v22, 0x2 move-object/from16 v0, p0 iget v0, v0, Lcom/x/kvm/cl/kvm/Decode;->color_depth:I move/from16 v23, v0 move/from16 v0, v22 move/from16 v1, v23 if-ne v0, v1, :cond_f1 .line 92 and-int/lit8 v22, v21, 0x1c shl-int/lit8 v15, v22, 0x3 .line 93 .restart local v15 # "r":I and-int/lit16 v10, v13, 0xe0 .line 94 .restart local v10 # "g":I and-int/lit8 v22, v13, 0x7 shl-int/lit8 v3, v22, 0x5 .restart local v3 # "b":I goto :goto_7b .line 97 .end local v3 # "b":I .end local v10 # "g":I .end local v15 # "r":I :cond_f1 and-int/lit8 v22, v13, 0x7 shl-int/lit8 v15, v22, 0x5 .line 98 .restart local v15 # "r":I move v10, v15 .line 99 .restart local v10 # "g":I move v3, v15 .restart local v3 # "b":I goto :goto_7b .line 110 .end local v3 # "b":I .end local v10 # "g":I .end local v13 # "nxtsrctmp":I .end local v15 # "r":I :cond_f8 move/from16 v0, v21 and-int/lit16 v0, v0, 0xe0 move/from16 v22, v0 if-nez v22, :cond_15e .line 112 const/4 v9, 0x5 .line 113 .local v9, "factor":I and-int/lit8 v16, v21, 0x1f .line 114 .local v16, "repeat_count":I add-int/lit8 p2, p2, 0x1 .line 115 :goto_105 move-object/from16 v0, p0 iget v0, v0, Lcom/x/kvm/cl/kvm/Decode;->offset_byte:I move/from16 v22, v0 add-int v22, v22, p2 const v23, 0x63e700 rem-int v22, v22, v23 aget-byte v22, v19, v22 move/from16 v0, v22 and-int/lit16 v0, v0, 0xe0 move/from16 v22, v0 if-nez v22, :cond_146 add-int v22, v7, v16 const/16 v23, 0x400 move/from16 v0, v22 move/from16 v1, v23 if-ge v0, v1, :cond_146 move/from16 v0, p2 move/from16 v1, p3 if-ge v0, v1, :cond_146 .line 116 move-object/from16 v0, p0 iget v0, v0, Lcom/x/kvm/cl/kvm/Decode;->offset_byte:I move/from16 v22, v0 add-int v22, v22, p2 const v23, 0x63e700 rem-int v22, v22, v23 aget-byte v22, v19, v22 and-int/lit8 v22, v22, 0x1f shl-int v22, v22, v9 or-int v16, v16, v22 .line 117 add-int/lit8 v9, v9, 0x5 .line 118 add-int/lit8 p2, p2, 0x1 goto :goto_105 .line 121 :cond_146 add-int v22, v7, v16 const/16 v23, 0x400 move/from16 v0, v22 move/from16 v1, v23 if-le v0, v1, :cond_15a .line 122 const/4 v4, 0x1 .line 229 .end local v9 # "factor":I .end local v16 # "repeat_count":I .end local v21 # "srctmp":B :cond_151 :goto_151 const/16 v22, 0x400 move/from16 v0, v22 if-eq v7, v0, :cond_159 .line 237 const/16 p2, -0x1 .line 240 .end local p2 # "index":I :cond_159 return p2 .line 125 .restart local v9 # "factor":I .restart local v16 # "repeat_count":I .restart local v21 # "srctmp":B .restart local p2 # "index":I :cond_15a add-int v7, v7, v16 .line 126 goto/16 :goto_17 .end local v9 # "factor":I .end local v16 # "repeat_count":I :cond_15e const/16 v22, 0x20 move/from16 v0, v21 and-int/lit16 v0, v0, 0xe0 move/from16 v23, v0 move/from16 v0, v22 move/from16 v1, v23 if-ne v0, v1, :cond_1e9 .line 128 const/4 v9, 0x5 .line 129 .restart local v9 # "factor":I and-int/lit8 v16, v21, 0x1f .line 130 .restart local v16 # "repeat_count":I add-int/lit8 p2, p2, 0x1 .line 131 :goto_171 const/16 v22, 0x20 move-object/from16 v0, p0 iget v0, v0, Lcom/x/kvm/cl/kvm/Decode;->offset_byte:I move/from16 v23, v0 add-int v23, v23, p2 const v24, 0x63e700 rem-int v23, v23, v24 aget-byte v23, v19, v23 move/from16 v0, v23 and-int/lit16 v0, v0, 0xe0 move/from16 v23, v0 move/from16 v0, v22 move/from16 v1, v23 if-ne v0, v1, :cond_1b8 add-int v22, v7, v16 const/16 v23, 0x400 move/from16 v0, v22 move/from16 v1, v23 if-ge v0, v1, :cond_1b8 move/from16 v0, p2 move/from16 v1, p3 if-ge v0, v1, :cond_1b8 .line 132 move-object/from16 v0, p0 iget v0, v0, Lcom/x/kvm/cl/kvm/Decode;->offset_byte:I move/from16 v22, v0 add-int v22, v22, p2 const v23, 0x63e700 rem-int v22, v22, v23 aget-byte v22, v19, v22 and-int/lit8 v22, v22, 0x1f shl-int v22, v22, v9 or-int v16, v16, v22 .line 133 add-int/lit8 v9, v9, 0x5 .line 134 add-int/lit8 p2, p2, 0x1 goto :goto_171 .line 136 :cond_1b8 add-int v22, v7, v16 const/16 v23, 0x400 move/from16 v0, v22 move/from16 v1, v23 if-le v0, v1, :cond_1c4 .line 137 const/4 v4, 0x1 .line 138 goto :goto_151 .line 140 :cond_1c4 const/16 v18, 0x0 .local v18, "roundit":I :goto_1c6 move/from16 v0, v18 move/from16 v1, v16 if-ge v0, v1, :cond_17 .line 143 move-object/from16 v0, p0 move/from16 v1, p1 invoke-virtual {v0, v1, v7}, Lcom/x/kvm/cl/kvm/Decode;->GETPOS(II)I move-result v8 .line 144 add-int/lit8 v22, v7, -0x1 move-object/from16 v0, p0 move/from16 v1, p1 move/from16 v2, v22 invoke-virtual {v0, v1, v2}, Lcom/x/kvm/cl/kvm/Decode;->GETPOS(II)I move-result v20 .line 145 aget v22, v6, v20 aput v22, v6, v8 .line 146 add-int/lit8 v7, v7, 0x1 .line 140 add-int/lit8 v18, v18, 0x1 goto :goto_1c6 .line 148 .end local v9 # "factor":I .end local v16 # "repeat_count":I .end local v18 # "roundit":I :cond_1e9 const/16 v22, 0x40 move/from16 v0, v21 and-int/lit16 v0, v0, 0xe0 move/from16 v23, v0 move/from16 v0, v22 move/from16 v1, v23 if-ne v0, v1, :cond_27a .line 150 const/4 v9, 0x5 .line 151 .restart local v9 # "factor":I and-int/lit8 v16, v21, 0x1f .line 152 .restart local v16 # "repeat_count":I add-int/lit8 p2, p2, 0x1 .line 153 :goto_1fc const/16 v22, 0x40 move-object/from16 v0, p0 iget v0, v0, Lcom/x/kvm/cl/kvm/Decode;->offset_byte:I move/from16 v23, v0 add-int v23, v23, p2 const v24, 0x63e700 rem-int v23, v23, v24 aget-byte v23, v19, v23 move/from16 v0, v23 and-int/lit16 v0, v0, 0xe0 move/from16 v23, v0 move/from16 v0, v22 move/from16 v1, v23 if-ne v0, v1, :cond_243 add-int v22, v7, v16 const/16 v23, 0x400 move/from16 v0, v22 move/from16 v1, v23 if-ge v0, v1, :cond_243 move/from16 v0, p2 move/from16 v1, p3 if-ge v0, v1, :cond_243 .line 154 move-object/from16 v0, p0 iget v0, v0, Lcom/x/kvm/cl/kvm/Decode;->offset_byte:I move/from16 v22, v0 add-int v22, v22, p2 const v23, 0x63e700 rem-int v22, v22, v23 aget-byte v22, v19, v22 and-int/lit8 v22, v22, 0x1f shl-int v22, v22, v9 or-int v16, v16, v22 .line 155 add-int/lit8 v9, v9, 0x5 .line 156 add-int/lit8 p2, p2, 0x1 goto :goto_1fc .line 158 :cond_243 add-int v22, v7, v16 const/16 v23, 0x400 move/from16 v0, v22 move/from16 v1, v23 if-le v0, v1, :cond_250 .line 159 const/4 v4, 0x1 .line 160 goto/16 :goto_151 .line 162 :cond_250 const/16 v18, 0x0 .restart local v18 # "roundit":I :goto_252 move/from16 v0, v18 move/from16 v1, v16 if-ge v0, v1, :cond_17 .line 168 move-object/from16 v0, p0 move/from16 v1, p1 invoke-virtual {v0, v1, v7}, Lcom/x/kvm/cl/kvm/Decode;->GETPOS(II)I move-result v8 .line 169 add-int/lit8 v22, v8, -0x20 if-gez v22, :cond_269 .line 179 :goto_264 add-int/lit8 v7, v7, 0x1 .line 162 add-int/lit8 v18, v18, 0x1 goto :goto_252 .line 172 :cond_269 add-int/lit8 v22, v7, -0x20 move-object/from16 v0, p0 move/from16 v1, p1 move/from16 v2, v22 invoke-virtual {v0, v1, v2}, Lcom/x/kvm/cl/kvm/Decode;->GETPOS(II)I move-result v20 .line 173 aget v22, v6, v20 aput v22, v6, v8 goto :goto_264 .line 181 .end local v9 # "factor":I .end local v16 # "repeat_count":I .end local v18 # "roundit":I :cond_27a const/16 v22, 0x60 move/from16 v0, v21 and-int/lit16 v0, v0, 0xe0 move/from16 v23, v0 move/from16 v0, v22 move/from16 v1, v23 if-ne v0, v1, :cond_33a .line 183 and-int/lit8 v22, v21, 0xf move/from16 v0, v22 int-to-byte v0, v0 move/from16 v17, v0 .line 184 .local v17, "result":B const/16 v11, 0x8 .line 185 .local v11, "mask":B and-int/lit8 v22, v21, 0x10 move/from16 v0, v22 and-int/lit16 v0, v0, 0xff move/from16 v22, v0 move/from16 v0, v22 int-to-char v12, v0 .line 187 .local v12, "ms_mf":C :goto_29c if-eqz v11, :cond_2bf .line 189 move-object/from16 v0, p0 move/from16 v1, p1 invoke-virtual {v0, v1, v7}, Lcom/x/kvm/cl/kvm/Decode;->GETPOS(II)I move-result v8 .line 190 and-int v22, v17, v11 if-eqz v22, :cond_2b8 .line 191 const/16 v22, 0x1 aget v22, v5, v22 aput v22, v6, v8 .line 195 :goto_2b0 shr-int/lit8 v22, v11, 0x1 move/from16 v0, v22 int-to-byte v11, v0 .line 196 add-int/lit8 v7, v7, 0x1 goto :goto_29c .line 193 :cond_2b8 const/16 v22, 0x0 aget v22, v5, v22 aput v22, v6, v8 goto :goto_2b0 .line 198 :cond_2bf add-int/lit8 p2, p2, 0x1 .line 199 if-eqz v12, :cond_17 const/16 v22, 0x400 move/from16 v0, v22 if-ge v7, v0, :cond_17 move/from16 v0, p2 move/from16 v1, p3 if-ge v0, v1, :cond_17 .line 201 :cond_2cf move-object/from16 v0, p0 iget v0, v0, Lcom/x/kvm/cl/kvm/Decode;->offset_byte:I move/from16 v22, v0 add-int v22, v22, p2 const v23, 0x63e700 rem-int v22, v22, v23 aget-byte v22, v19, v22 and-int/lit8 v22, v22, 0x7f move/from16 v0, v22 int-to-byte v0, v0 move/from16 v17, v0 .line 202 const/16 v11, 0x40 .line 203 move-object/from16 v0, p0 iget v0, v0, Lcom/x/kvm/cl/kvm/Decode;->offset_byte:I move/from16 v22, v0 add-int v22, v22, p2 const v23, 0x63e700 rem-int v22, v22, v23 aget-byte v22, v19, v22 move/from16 v0, v22 and-int/lit16 v0, v0, 0x80 move/from16 v22, v0 move/from16 v0, v22 and-int/lit16 v0, v0, 0xff move/from16 v22, v0 move/from16 v0, v22 int-to-char v12, v0 .line 204 :goto_305 if-eqz v11, :cond_328 .line 206 move-object/from16 v0, p0 move/from16 v1, p1 invoke-virtual {v0, v1, v7}, Lcom/x/kvm/cl/kvm/Decode;->GETPOS(II)I move-result v8 .line 207 and-int v22, v17, v11 if-eqz v22, :cond_321 .line 208 const/16 v22, 0x1 aget v22, v5, v22 aput v22, v6, v8 .line 212 :goto_319 shr-int/lit8 v22, v11, 0x1 move/from16 v0, v22 int-to-byte v11, v0 .line 213 add-int/lit8 v7, v7, 0x1 goto :goto_305 .line 210 :cond_321 const/16 v22, 0x0 aget v22, v5, v22 aput v22, v6, v8 goto :goto_319 .line 215 :cond_328 add-int/lit8 p2, p2, 0x1 .line 216 if-eqz v12, :cond_17 const/16 v22, 0x400 move/from16 v0, v22 if-ge v7, v0, :cond_17 move/from16 v0, p2 move/from16 v1, p3 if-lt v0, v1, :cond_2cf goto/16 :goto_17 .line 222 .end local v11 # "mask":B .end local v12 # "ms_mf":C .end local v17 # "result":B :cond_33a add-int/lit8 p2, p2, 0x1 goto/16 :goto_17 .end method .method decode_single_block_0(III)I .registers 31 .param p1, "bpos" # I .param p2, "index" # I .param p3, "len" # I .line 247 const/4 v6, 0x0 .line 248 .local v6, "dst_count":I const/4 v7, 0x0 .local v7, "dst_pos":I const/16 v22, 0x0 .line 250 .local v22, "src_pos":I move-object/from16 v0, p0 iget-object v0, v0, Lcom/x/kvm/cl/kvm/Decode;->srcBuf:[B move-object/from16 v21, v0 .line 251 .local v21, "src_buf":[B move-object/from16 v0, p0 iget-object v5, v0, Lcom/x/kvm/cl/kvm/Decode;->dstBuf:[I .line 252 .local v5, "dst_buf":[I move-object/from16 v0, p0 iget-object v4, v0, Lcom/x/kvm/cl/kvm/Decode;->colorSet:[I .line 253 .local v4, "color_set":[I move-object/from16 v0, p0 iget-object v0, v0, Lcom/x/kvm/cl/kvm/Decode;->posTable:[I move-object/from16 v16, v0 .line 254 .local v16, "pos_table":[I move/from16 v11, p2 .local v11, "idx":I move/from16 v12, p2 .line 261 .end local p2 # "index":I .local v12, "index":I :goto_1c const/16 v24, 0x400 move/from16 v0, v24 if-ge v6, v0, :cond_338 move/from16 v0, p3 if-ge v12, v0, :cond_338 .line 262 move-object/from16 v0, p0 iget v0, v0, Lcom/x/kvm/cl/kvm/Decode;->offset_byte:I move/from16 v24, v0 add-int v24, v24, v12 const v25, 0x63e700 rem-int v24, v24, v25 aget-byte v23, v21, v24 .line 263 .local v23, "srctmp":B const/16 v24, 0x80 move/from16 v0, v23 and-int/lit16 v0, v0, 0x80 move/from16 v25, v0 move/from16 v0, v24 move/from16 v1, v25 if-ne v0, v1, :cond_120 .line 265 add-int/lit8 v24, v12, 0x1 move-object/from16 v0, p0 iget v0, v0, Lcom/x/kvm/cl/kvm/Decode;->offset_byte:I move/from16 v25, v0 add-int v24, v24, v25 const v25, 0x63e700 rem-int v24, v24, v25 aget-byte v15, v21, v24 .line 267 .local v15, "nxtsrctmp":I move-object/from16 v0, p0 move/from16 v1, p1 invoke-virtual {v0, v1, v6}, Lcom/x/kvm/cl/kvm/Decode;->GETPOS(II)I move-result v7 .line 269 const/16 v24, 0x8 move-object/from16 v0, p0 iget v0, v0, Lcom/x/kvm/cl/kvm/Decode;->color_depth:I move/from16 v25, v0 move/from16 v0, v24 move/from16 v1, v25 if-ne v0, v1, :cond_ba .line 273 and-int/lit8 v24, v23, 0x7c shl-int/lit8 v17, v24, 0x1 .line 274 .local v17, "r":I and-int/lit8 v24, v23, 0x3 shl-int/lit8 v24, v24, 0x6 and-int/lit16 v0, v15, 0xe0 move/from16 v25, v0 shr-int/lit8 v25, v25, 0x2 or-int v10, v24, v25 .line 275 .local v10, "g":I and-int/lit8 v24, v15, 0x1f shl-int/lit8 v3, v24, 0x3 .line 293 .local v3, "b":I :goto_7e const/high16 v24, -0x1000000 shl-int/lit8 v25, v17, 0x10 or-int v24, v24, v25 shl-int/lit8 v25, v10, 0x8 or-int v24, v24, v25 or-int v24, v24, v3 :try_start_8a aput v24, v5, v7 :try_end_8c .catch Ljava/lang/Exception; {:try_start_8a .. :try_end_8c} :catch_ff .line 297 :goto_8c aget v24, v5, v7 const/16 v25, 0x0 aget v25, v4, v25 move/from16 v0, v24 move/from16 v1, v25 if-eq v0, v1, :cond_b2 aget v24, v5, v7 const/16 v25, 0x1 aget v25, v4, v25 move/from16 v0, v24 move/from16 v1, v25 if-eq v0, v1, :cond_b2 .line 298 const/16 v24, 0x1 const/16 v25, 0x0 aget v25, v4, v25 aput v25, v4, v24 .line 299 const/16 v24, 0x0 aget v25, v5, v7 aput v25, v4, v24 .line 302 :cond_b2 add-int/lit8 p2, v12, 0x2 .line 303 .end local v12 # "index":I .restart local p2 # "index":I add-int/lit8 v6, v6, 0x1 .end local v3 # "b":I .end local v10 # "g":I .end local v15 # "nxtsrctmp":I .end local v17 # "r":I :cond_b6 :goto_b6 move/from16 v12, p2 .line 408 .end local p2 # "index":I .restart local v12 # "index":I goto/16 :goto_1c .line 276 .restart local v15 # "nxtsrctmp":I :cond_ba const/16 v24, 0x4 move-object/from16 v0, p0 iget v0, v0, Lcom/x/kvm/cl/kvm/Decode;->color_depth:I move/from16 v25, v0 move/from16 v0, v24 move/from16 v1, v25 if-ne v0, v1, :cond_dd .line 278 and-int/lit8 v24, v23, 0x3c shl-int/lit8 v17, v24, 0x2 .line 279 .restart local v17 # "r":I and-int/lit8 v24, v23, 0x1 shl-int/lit8 v24, v24, 0x7 and-int/lit16 v0, v15, 0xe0 move/from16 v25, v0 shr-int/lit8 v25, v25, 0x1 or-int v10, v24, v25 .line 280 .restart local v10 # "g":I and-int/lit8 v24, v15, 0xf shl-int/lit8 v3, v24, 0x4 .restart local v3 # "b":I goto :goto_7e .line 281 .end local v3 # "b":I .end local v10 # "g":I .end local v17 # "r":I :cond_dd const/16 v24, 0x2 move-object/from16 v0, p0 iget v0, v0, Lcom/x/kvm/cl/kvm/Decode;->color_depth:I move/from16 v25, v0 move/from16 v0, v24 move/from16 v1, v25 if-ne v0, v1, :cond_f6 .line 283 and-int/lit8 v24, v23, 0x1c shl-int/lit8 v17, v24, 0x3 .line 284 .restart local v17 # "r":I and-int/lit16 v10, v15, 0xe0 .line 285 .restart local v10 # "g":I and-int/lit8 v24, v15, 0x7 shl-int/lit8 v3, v24, 0x5 .restart local v3 # "b":I goto :goto_7e .line 288 .end local v3 # "b":I .end local v10 # "g":I .end local v17 # "r":I :cond_f6 and-int/lit8 v24, v15, 0x7 shl-int/lit8 v17, v24, 0x5 .line 289 .restart local v17 # "r":I move/from16 v10, v17 .line 290 .restart local v10 # "g":I move/from16 v3, v17 .restart local v3 # "b":I goto :goto_7e .line 294 :catch_ff move-exception v8 .line 295 .local v8, "exx":Ljava/lang/Exception; sget-object v24, Lcom/x/base/log/Log;->jcLog:Lcom/x/base/log/Logger; new-instance v25, Ljava/lang/StringBuilder; invoke-direct/range {v25 .. v25}, Ljava/lang/StringBuilder;-><init>()V const-string v26, "dst_pos=" invoke-virtual/range {v25 .. v26}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v25 move-object/from16 v0, v25 invoke-virtual {v0, v7}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder; move-result-object v25 invoke-virtual/range {v25 .. v25}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object v25 move-object/from16 v0, v24 move-object/from16 v1, v25 invoke-virtual {v0, v1, v8}, Lcom/x/base/log/Logger;->error(Ljava/lang/String;Ljava/lang/Throwable;)V goto/16 :goto_8c .line 304 .end local v3 # "b":I .end local v8 # "exx":Ljava/lang/Exception; .end local v10 # "g":I .end local v15 # "nxtsrctmp":I .end local v17 # "r":I :cond_120 move/from16 v0, v23 and-int/lit16 v0, v0, 0xe0 move/from16 v24, v0 if-nez v24, :cond_172 .line 306 const/4 v9, 0x5 .line 307 .local v9, "factor":I and-int/lit8 v18, v23, 0x1f .line 308 .local v18, "repeat_count":I add-int/lit8 p2, v12, 0x1 .line 309 .end local v12 # "index":I .restart local p2 # "index":I :goto_12d move-object/from16 v0, p0 iget v0, v0, Lcom/x/kvm/cl/kvm/Decode;->offset_byte:I move/from16 v24, v0 add-int v24, v24, p2 const v25, 0x63e700 rem-int v24, v24, v25 aget-byte v24, v21, v24 move/from16 v0, v24 and-int/lit16 v0, v0, 0xe0 move/from16 v24, v0 if-nez v24, :cond_16e add-int v24, v6, v18 const/16 v25, 0x400 move/from16 v0, v24 move/from16 v1, v25 if-ge v0, v1, :cond_16e move/from16 v0, p2 move/from16 v1, p3 if-ge v0, v1, :cond_16e .line 310 move-object/from16 v0, p0 iget v0, v0, Lcom/x/kvm/cl/kvm/Decode;->offset_byte:I move/from16 v24, v0 add-int v24, v24, p2 const v25, 0x63e700 rem-int v24, v24, v25 aget-byte v24, v21, v24 and-int/lit8 v24, v24, 0x1f shl-int v24, v24, v9 or-int v18, v18, v24 .line 311 add-int/lit8 v9, v9, 0x5 .line 312 add-int/lit8 p2, p2, 0x1 goto :goto_12d .line 314 :cond_16e add-int v6, v6, v18 .line 315 goto/16 :goto_b6 .end local v9 # "factor":I .end local v18 # "repeat_count":I .end local p2 # "index":I .restart local v12 # "index":I :cond_172 const/16 v24, 0x20 move/from16 v0, v23 and-int/lit16 v0, v0, 0xe0 move/from16 v25, v0 move/from16 v0, v24 move/from16 v1, v25 if-ne v0, v1, :cond_1f1 .line 317 const/4 v9, 0x5 .line 318 .restart local v9 # "factor":I and-int/lit8 v18, v23, 0x1f .line 319 .restart local v18 # "repeat_count":I add-int/lit8 p2, v12, 0x1 .line 320 .end local v12 # "index":I .restart local p2 # "index":I :goto_185 const/16 v24, 0x20 move-object/from16 v0, p0 iget v0, v0, Lcom/x/kvm/cl/kvm/Decode;->offset_byte:I move/from16 v25, v0 add-int v25, v25, p2 const v26, 0x63e700 rem-int v25, v25, v26 aget-byte v25, v21, v25 move/from16 v0, v25 and-int/lit16 v0, v0, 0xe0 move/from16 v25, v0 move/from16 v0, v24 move/from16 v1, v25 if-ne v0, v1, :cond_1cc add-int v24, v6, v18 const/16 v25, 0x400 move/from16 v0, v24 move/from16 v1, v25 if-ge v0, v1, :cond_1cc move/from16 v0, p2 move/from16 v1, p3 if-ge v0, v1, :cond_1cc .line 321 move-object/from16 v0, p0 iget v0, v0, Lcom/x/kvm/cl/kvm/Decode;->offset_byte:I move/from16 v24, v0 add-int v24, v24, p2 const v25, 0x63e700 rem-int v24, v24, v25 aget-byte v24, v21, v24 and-int/lit8 v24, v24, 0x1f shl-int v24, v24, v9 or-int v18, v18, v24 .line 322 add-int/lit8 v9, v9, 0x5 .line 323 add-int/lit8 p2, p2, 0x1 goto :goto_185 .line 325 :cond_1cc const/16 v20, 0x0 .local v20, "roundit":I :goto_1ce move/from16 v0, v20 move/from16 v1, v18 if-ge v0, v1, :cond_b6 .line 328 move-object/from16 v0, p0 move/from16 v1, p1 invoke-virtual {v0, v1, v6}, Lcom/x/kvm/cl/kvm/Decode;->GETPOS(II)I move-result v7 .line 329 add-int/lit8 v24, v6, -0x1 move-object/from16 v0, p0 move/from16 v1, p1 move/from16 v2, v24 invoke-virtual {v0, v1, v2}, Lcom/x/kvm/cl/kvm/Decode;->GETPOS(II)I move-result v22 .line 330 aget v24, v5, v22 aput v24, v5, v7 .line 331 add-int/lit8 v6, v6, 0x1 .line 325 add-int/lit8 v20, v20, 0x1 goto :goto_1ce .line 333 .end local v9 # "factor":I .end local v18 # "repeat_count":I .end local v20 # "roundit":I .end local p2 # "index":I .restart local v12 # "index":I :cond_1f1 const/16 v24, 0x40 move/from16 v0, v23 and-int/lit16 v0, v0, 0xe0 move/from16 v25, v0 move/from16 v0, v24 move/from16 v1, v25 if-ne v0, v1, :cond_275 .line 335 const/4 v9, 0x5 .line 336 .restart local v9 # "factor":I and-int/lit8 v18, v23, 0x1f .line 337 .restart local v18 # "repeat_count":I add-int/lit8 p2, v12, 0x1 .line 338 .end local v12 # "index":I .restart local p2 # "index":I :goto_204 const/16 v24, 0x40 move-object/from16 v0, p0 iget v0, v0, Lcom/x/kvm/cl/kvm/Decode;->offset_byte:I move/from16 v25, v0 add-int v25, v25, p2 const v26, 0x63e700 rem-int v25, v25, v26 aget-byte v25, v21, v25 move/from16 v0, v25 and-int/lit16 v0, v0, 0xe0 move/from16 v25, v0 move/from16 v0, v24 move/from16 v1, v25 if-ne v0, v1, :cond_24b add-int v24, v6, v18 const/16 v25, 0x400 move/from16 v0, v24 move/from16 v1, v25 if-ge v0, v1, :cond_24b move/from16 v0, p2 move/from16 v1, p3 if-ge v0, v1, :cond_24b .line 339 move-object/from16 v0, p0 iget v0, v0, Lcom/x/kvm/cl/kvm/Decode;->offset_byte:I move/from16 v24, v0 add-int v24, v24, p2 const v25, 0x63e700 rem-int v24, v24, v25 aget-byte v24, v21, v24 and-int/lit8 v24, v24, 0x1f shl-int v24, v24, v9 or-int v18, v18, v24 .line 340 add-int/lit8 v9, v9, 0x5 .line 341 add-int/lit8 p2, p2, 0x1 goto :goto_204 .line 343 :cond_24b const/16 v20, 0x0 .restart local v20 # "roundit":I :goto_24d move/from16 v0, v20 move/from16 v1, v18 if-ge v0, v1, :cond_b6 .line 349 move-object/from16 v0, p0 move/from16 v1, p1 invoke-virtual {v0, v1, v6}, Lcom/x/kvm/cl/kvm/Decode;->GETPOS(II)I move-result v7 .line 350 add-int/lit8 v24, v7, -0x20 if-gez v24, :cond_264 .line 360 :goto_25f add-int/lit8 v6, v6, 0x1 .line 343 add-int/lit8 v20, v20, 0x1 goto :goto_24d .line 353 :cond_264 add-int/lit8 v24, v6, -0x20 move-object/from16 v0, p0 move/from16 v1, p1 move/from16 v2, v24 invoke-virtual {v0, v1, v2}, Lcom/x/kvm/cl/kvm/Decode;->GETPOS(II)I move-result v22 .line 354 aget v24, v5, v22 aput v24, v5, v7 goto :goto_25f .line 362 .end local v9 # "factor":I .end local v18 # "repeat_count":I .end local v20 # "roundit":I .end local p2 # "index":I .restart local v12 # "index":I :cond_275 const/16 v24, 0x60 move/from16 v0, v23 and-int/lit16 v0, v0, 0xe0 move/from16 v25, v0 move/from16 v0, v24 move/from16 v1, v25 if-ne v0, v1, :cond_335 .line 364 and-int/lit8 v24, v23, 0xf move/from16 v0, v24 int-to-byte v0, v0 move/from16 v19, v0 .line 365 .local v19, "result":B const/16 v13, 0x8 .line 366 .local v13, "mask":B and-int/lit8 v24, v23, 0x10 move/from16 v0, v24 and-int/lit16 v0, v0, 0xff move/from16 v24, v0 move/from16 v0, v24 int-to-char v14, v0 .line 368 .local v14, "ms_mf":C :goto_297 if-eqz v13, :cond_2ba .line 370 move-object/from16 v0, p0 move/from16 v1, p1 invoke-virtual {v0, v1, v6}, Lcom/x/kvm/cl/kvm/Decode;->GETPOS(II)I move-result v7 .line 371 and-int v24, v19, v13 if-eqz v24, :cond_2b3 .line 372 const/16 v24, 0x1 aget v24, v4, v24 aput v24, v5, v7 .line 376 :goto_2ab shr-int/lit8 v24, v13, 0x1 move/from16 v0, v24 int-to-byte v13, v0 .line 377 add-int/lit8 v6, v6, 0x1 goto :goto_297 .line 374 :cond_2b3 const/16 v24, 0x0 aget v24, v4, v24 aput v24, v5, v7 goto :goto_2ab .line 379 :cond_2ba add-int/lit8 p2, v12, 0x1 .line 380 .end local v12 # "index":I .restart local p2 # "index":I if-eqz v14, :cond_b6 const/16 v24, 0x400 move/from16 v0, v24 if-ge v6, v0, :cond_b6 move/from16 v0, p2 move/from16 v1, p3 if-ge v0, v1, :cond_b6 .line 382 :cond_2ca move-object/from16 v0, p0 iget v0, v0, Lcom/x/kvm/cl/kvm/Decode;->offset_byte:I move/from16 v24, v0 add-int v24, v24, p2 const v25, 0x63e700 rem-int v24, v24, v25 aget-byte v24, v21, v24 and-int/lit8 v24, v24, 0x7f move/from16 v0, v24 int-to-byte v0, v0 move/from16 v19, v0 .line 383 const/16 v13, 0x40 .line 384 move-object/from16 v0, p0 iget v0, v0, Lcom/x/kvm/cl/kvm/Decode;->offset_byte:I move/from16 v24, v0 add-int v24, v24, p2 const v25, 0x63e700 rem-int v24, v24, v25 aget-byte v24, v21, v24 move/from16 v0, v24 and-int/lit16 v0, v0, 0x80 move/from16 v24, v0 move/from16 v0, v24 and-int/lit16 v0, v0, 0xff move/from16 v24, v0 move/from16 v0, v24 int-to-char v14, v0 .line 385 :goto_300 if-eqz v13, :cond_323 .line 387 move-object/from16 v0, p0 move/from16 v1, p1 invoke-virtual {v0, v1, v6}, Lcom/x/kvm/cl/kvm/Decode;->GETPOS(II)I move-result v7 .line 388 and-int v24, v19, v13 if-eqz v24, :cond_31c .line 389 const/16 v24, 0x1 aget v24, v4, v24 aput v24, v5, v7 .line 393 :goto_314 shr-int/lit8 v24, v13, 0x1 move/from16 v0, v24 int-to-byte v13, v0 .line 394 add-int/lit8 v6, v6, 0x1 goto :goto_300 .line 391 :cond_31c const/16 v24, 0x0 aget v24, v4, v24 aput v24, v5, v7 goto :goto_314 .line 396 :cond_323 add-int/lit8 p2, p2, 0x1 .line 397 if-eqz v14, :cond_b6 const/16 v24, 0x400 move/from16 v0, v24 if-ge v6, v0, :cond_b6 move/from16 v0, p2 move/from16 v1, p3 if-lt v0, v1, :cond_2ca goto/16 :goto_b6 .line 403 .end local v13 # "mask":B .end local v14 # "ms_mf":C .end local v19 # "result":B .end local p2 # "index":I .restart local v12 # "index":I :cond_335 add-int/lit8 p2, v12, 0x1 .line 415 .end local v11 # "idx":I .end local v12 # "index":I .end local v23 # "srctmp":B .restart local p2 # "index":I :goto_337 return v11 .line 410 .end local p2 # "index":I .restart local v11 # "idx":I .restart local v12 # "index":I :cond_338 const/16 v24, 0x400 move/from16 v0, v24 if-eq v6, v0, :cond_341 move/from16 p2, v12 .line 412 .end local v12 # "index":I .restart local p2 # "index":I goto :goto_337 .end local p2 # "index":I .restart local v12 # "index":I :cond_341 move/from16 p2, v12 .end local v12 # "index":I .restart local p2 # "index":I move v11, v12 .line 415 goto :goto_337 .end method .method public decode_single_frame(IIIZ)I .registers 16 .param p1, "len" # I .param p2, "offset" # I .param p3, "color_depth" # I .param p4, "first_half_frame" # Z .line 474 const/4 v3, 0x0 .line 475 .local v3, "index":I const/4 v2, 0x0 .line 476 .local v2, "block_start_index":I iget-object v8, p0, Lcom/x/kvm/cl/kvm/Decode;->srcBuf:[B .line 478 .local v8, "src_buf":[B const/4 v5, 0x0 .local v5, "ret":I const/4 v1, 0x0 .line 479 .local v1, "block_error":I const/4 v7, 0x0 .line 480 .local v7, "slice_num":I const/4 v6, 0x0 .line 481 .local v6, "slice_idx":I const/4 v0, 0x0 .line 482 .local v0, "block_cnt":I const/4 v4, 0x0 .line 484 .local v4, "index_old":I mul-int/lit16 v9, p2, 0x3ff0 iput v9, p0, Lcom/x/kvm/cl/kvm/Decode;->offset_byte:I .line 486 iput p3, p0, Lcom/x/kvm/cl/kvm/Decode;->color_depth:I .line 488 if-eqz p4, :cond_18 .line 489 const/4 v9, 0x0 iput v9, p0, Lcom/x/kvm/cl/kvm/Decode;->index_x:I .line 490 const/4 v9, 0x0 iput v9, p0, Lcom/x/kvm/cl/kvm/Decode;->index_y:I .line 502 :cond_18 iget v9, p0, Lcom/x/kvm/cl/kvm/Decode;->block_x_num:I iget v10, p0, Lcom/x/kvm/cl/kvm/Decode;->block_y_num:I mul-int/2addr v9, v10 add-int/lit8 v9, v9, 0x10 div-int/lit8 v7, v9, 0x10 .line 503 :cond_21 :goto_21 if-ge v3, p1, :cond_a6 .line 505 invoke-virtual {p0, p1, v3}, Lcom/x/kvm/cl/kvm/Decode;->search_slice_header(II)I move-result v5 .line 506 const/4 v9, -0x1 if-ne v5, v9, :cond_33 .line 508 sget-object v9, Lcom/x/base/log/Log;->jcLog:Lcom/x/base/log/Logger; const-string v10, ">>>>>>解码出错:没找到slice头" invoke-virtual {v9, v10}, Lcom/x/base/log/Logger;->info(Ljava/lang/String;)V .line 509 const/4 v9, -0x1 .line 590 :goto_32 return v9 .line 511 :cond_33 add-int/lit8 v9, v3, 0x8 if-eq v5, v9, :cond_37 .line 514 :cond_37 move v3, v5 .line 515 iget v9, p0, Lcom/x/kvm/cl/kvm/Decode;->slice_y:I add-int/lit8 v9, v9, -0x1 iget v10, p0, Lcom/x/kvm/cl/kvm/Decode;->block_x_num:I mul-int/2addr v9, v10 iget v10, p0, Lcom/x/kvm/cl/kvm/Decode;->slice_x:I add-int/2addr v9, v10 add-int/lit8 v9, v9, 0x10 div-int/lit8 v6, v9, 0x10 .line 517 if-le v6, v7, :cond_51 .line 519 sget-object v9, Lcom/x/base/log/Log;->jcLog:Lcom/x/base/log/Logger; const-string v10, ">>>>>>解码出错:slice超出边界" invoke-virtual {v9, v10}, Lcom/x/base/log/Logger;->info(Ljava/lang/String;)V .line 520 const/4 v9, -0x1 goto :goto_32 .line 522 :cond_51 iget v9, p0, Lcom/x/kvm/cl/kvm/Decode;->slice_x:I add-int/lit8 v9, v9, -0x1 iput v9, p0, Lcom/x/kvm/cl/kvm/Decode;->index_x:I .line 523 iget v9, p0, Lcom/x/kvm/cl/kvm/Decode;->slice_y:I add-int/lit8 v9, v9, -0x1 iput v9, p0, Lcom/x/kvm/cl/kvm/Decode;->index_y:I .line 524 const/4 v0, 0x0 :goto_5e const/16 v9, 0x10 if-ge v0, v9, :cond_21 .line 525 iget v9, p0, Lcom/x/kvm/cl/kvm/Decode;->index_x:I iget v10, p0, Lcom/x/kvm/cl/kvm/Decode;->block_x_num:I if-ge v9, v10, :cond_6e iget v9, p0, Lcom/x/kvm/cl/kvm/Decode;->index_y:I iget v10, p0, Lcom/x/kvm/cl/kvm/Decode;->block_y_num:I if-lt v9, v10, :cond_70 .line 530 :cond_6e const/4 v9, -0x1 goto :goto_32 .line 534 :cond_70 iget v9, p0, Lcom/x/kvm/cl/kvm/Decode;->index_y:I mul-int/lit16 v9, v9, 0x400 iget v10, p0, Lcom/x/kvm/cl/kvm/Decode;->block_x_num:I mul-int/2addr v9, v10 iget v10, p0, Lcom/x/kvm/cl/kvm/Decode;->index_x:I mul-int/lit8 v10, v10, 0x20 add-int v2, v9, v10 .line 536 move v4, v3 .line 537 invoke-virtual {p0, v2, v3, p1}, Lcom/x/kvm/cl/kvm/Decode;->decode_single_block_0(III)I move-result v3 .line 538 if-ne v4, v3, :cond_8d .line 540 const/4 v1, 0x1 .line 543 sget-object v9, Lcom/x/base/log/Log;->jcLog:Lcom/x/base/log/Logger; const-string v10, ">>>>>>解码出错:块解码出错" invoke-virtual {v9, v10}, Lcom/x/base/log/Logger;->info(Ljava/lang/String;)V goto :goto_21 .line 546 :cond_8d const/4 v1, 0x0 .line 547 iget v9, p0, Lcom/x/kvm/cl/kvm/Decode;->index_x:I add-int/lit8 v9, v9, 0x1 iput v9, p0, Lcom/x/kvm/cl/kvm/Decode;->index_x:I .line 548 iget v9, p0, Lcom/x/kvm/cl/kvm/Decode;->index_x:I iget v10, p0, Lcom/x/kvm/cl/kvm/Decode;->block_x_num:I if-ne v9, v10, :cond_a3 .line 549 const/4 v9, 0x0 iput v9, p0, Lcom/x/kvm/cl/kvm/Decode;->index_x:I .line 550 iget v9, p0, Lcom/x/kvm/cl/kvm/Decode;->index_y:I add-int/lit8 v9, v9, 0x1 iput v9, p0, Lcom/x/kvm/cl/kvm/Decode;->index_y:I .line 524 :cond_a3 add-int/lit8 v0, v0, 0x1 goto :goto_5e .line 586 :cond_a6 const/4 v9, 0x1 if-ne v1, v9, :cond_ab .line 587 const/4 v9, -0x2 goto :goto_32 .line 590 :cond_ab iget v9, p0, Lcom/x/kvm/cl/kvm/Decode;->real_width:I iget v10, p0, Lcom/x/kvm/cl/kvm/Decode;->real_height:I mul-int/2addr v9, v10 mul-int/lit8 v9, v9, 0x4 goto :goto_32 .end method .method init_pos_table()V .registers 11 const/16 v9, 0x20 .line 595 const/4 v0, 0x0 .line 596 .local v0, "index":I const/4 v3, 0x0 .line 597 .local v3, "pos":I iget-object v5, p0, Lcom/x/kvm/cl/kvm/Decode;->posTable:[I .line 598 .local v5, "pos_table":[I iget v8, p0, Lcom/x/kvm/cl/kvm/Decode;->width:I add-int/lit8 v2, v8, -0x20 .line 600 .local v2, "offset":I const/4 v7, 0x0 .local v7, "y":I :goto_b if-ge v7, v9, :cond_23 .line 601 const/4 v6, 0x0 .local v6, "x":I move v4, v3 .end local v3 # "pos":I .local v4, "pos":I move v1, v0 .end local v0 # "index":I .local v1, "index":I :goto_10 if-ge v6, v9, :cond_1d .line 602 add-int/lit8 v0, v1, 0x1 .end local v1 # "index":I .restart local v0 # "index":I add-int/lit8 v3, v4, 0x1 .end local v4 # "pos":I .restart local v3 # "pos":I aput v4, v5, v1 .line 601 add-int/lit8 v6, v6, 0x1 move v4, v3 .end local v3 # "pos":I .restart local v4 # "pos":I move v1, v0 .end local v0 # "index":I .restart local v1 # "index":I goto :goto_10 .line 604 :cond_1d add-int v3, v4, v2 .line 600 .end local v4 # "pos":I .restart local v3 # "pos":I add-int/lit8 v7, v7, 0x1 move v0, v1 .end local v1 # "index":I .restart local v0 # "index":I goto :goto_b .line 606 .end local v6 # "x":I :cond_23 return-void .end method .method search_slice_header(II)I .registers 10 .param p1, "src_len" # I .param p2, "index" # I const v6, 0x63e700 .line 427 const/4 v2, -0x1 .line 428 .local v2, "ret":I move v1, p2 .line 429 .local v1, "idx":I iget-object v3, p0, Lcom/x/kvm/cl/kvm/Decode;->srcBuf:[B .line 431 .local v3, "src_buf":[B :goto_7 if-ge v1, p1, :cond_42 .line 432 iget v4, p0, Lcom/x/kvm/cl/kvm/Decode;->offset_byte:I add-int/2addr v4, v1 rem-int/2addr v4, v6 aget-byte v0, v3, v4 .line 433 .local v0, "bs_data":B const/16 v4, 0x4f if-ne v0, v4, :cond_4b .line 435 add-int/lit8 v1, v1, 0x1 .line 436 iget v4, p0, Lcom/x/kvm/cl/kvm/Decode;->offset_byte:I add-int/2addr v4, v1 rem-int/2addr v4, v6 aget-byte v0, v3, v4 .line 437 const/16 v4, 0x4e if-ne v0, v4, :cond_48 .line 439 add-int/lit8 v1, v1, 0x1 .line 440 iget v4, p0, Lcom/x/kvm/cl/kvm/Decode;->offset_byte:I add-int/2addr v4, v1 rem-int/2addr v4, v6 aget-byte v0, v3, v4 .line 441 const/16 v4, 0x4c if-ne v0, v4, :cond_45 .line 443 add-int/lit8 v4, v1, 0x1 iget v5, p0, Lcom/x/kvm/cl/kvm/Decode;->offset_byte:I add-int/2addr v4, v5 rem-int/2addr v4, v6 aget-byte v4, v3, v4 iput v4, p0, Lcom/x/kvm/cl/kvm/Decode;->slice_x:I .line 444 add-int/lit8 v4, v1, 0x2 iget v5, p0, Lcom/x/kvm/cl/kvm/Decode;->offset_byte:I add-int/2addr v4, v5 rem-int/2addr v4, v6 aget-byte v4, v3, v4 iput v4, p0, Lcom/x/kvm/cl/kvm/Decode;->slice_y:I .line 446 add-int/lit8 v1, v1, 0x6 .line 448 const/4 v2, 0x1 .line 464 .end local v0 # "bs_data":B :cond_42 if-lez v2, :cond_4e .line 468 .end local v1 # "idx":I :goto_44 return v1 .line 452 .restart local v0 # "bs_data":B .restart local v1 # "idx":I :cond_45 add-int/lit8 v1, v1, 0x1 .line 453 goto :goto_7 .line 456 :cond_48 add-int/lit8 v1, v1, 0x1 .line 457 goto :goto_7 .line 460 :cond_4b add-int/lit8 v1, v1, 0x1 .line 461 goto :goto_7 .line 468 .end local v0 # "bs_data":B :cond_4e const/4 v1, -0x1 goto :goto_44 .end method
11-03
<think>好的,我现在需要把用户提供的Smali代码转换为Java代码。首先,我得仔细阅读这段Smali代码,理解其结构和功能。Smali是Android的Dalvik虚拟机使用的汇编语言,所以转换时要注意类、方法、字段的对应关系,以及如何处理寄存器和指令。 首先看类定义:`.class public Lcom/x/kvm/cl/kvm/Decode;`,对应的Java类应该是`com.x.kvm.cl.kvm.Decode`。接下来是继承关系`.super Ljava/lang/Object;`,说明这个类继承自Object。源文件名是"Decode.java"。 然后是注解部分,包括`AnnoBeanAttachToIoc`和`AnnoIocBean`,这些在Java中需要用注解语法表示,比如`@AnnoBeanAttachToIoc`和`@AnnoIocBean(beanName = "Decode")`。 接下来是静态字段定义,比如`IMG_BIT_USE`、`MAX_FILE_LEN`、`SRC_BUF_LEN`,这些在Java中直接声明为static final int,并赋值对应的十六进制数值。 实例字段如`block_x_num`、`block_y_num`等,转换为Java的成员变量,类型要对应,比如int、int[][]等。注意数组类型如`[I`对应int[],`[B`对应byte[],`[I`对应int[]等。 构造方法`<init>`对应Java的构造函数。需要处理寄存器分配,比如v0、v1等寄存器的使用,转换为Java中的局部变量。例如,初始化colorSet为长度为2的int数组,posTable为长度为0x400(1024)的int数组,slice_x和slice_y初始化为0。 方法`GETPOS`需要转换为Java方法,参数是int s和int i,返回int。处理条件判断和数组访问,比如当i超过0x3ff时返回0,否则从posTable中取值并处理。 其他方法如`curRes()`返回Dimension对象,需要创建并初始化width和height的值。`decode_init`方法处理参数,设置实例变量,并进行一些计算,比如调整real_height和real_width到20的倍数,计算block的数量等。 对于`decode_single_block`和`decode_single_block_0`这样的复杂方法,需要仔细分析寄存器的使用,转换为局部变量,处理循环、条件分支和数组操作。例如,处理颜色深度不同的情况,根据不同的位数提取RGB分量,并设置到dstBuf中。 还有异常处理的部分,比如try-catch块,在Java中需要用try-catch语句来捕获异常,并记录日志。 需要注意的是,Smali中的寄存器操作要转换为Java中的变量赋值和操作,同时保持逻辑的一致性。例如,`add-int/lit8 v7, v7, 0x1`对应Java中的v7++。 此外,方法调用如`invoke-virtual`需要转换为对应的Java方法调用,比如`GETPOS`方法的调用。 最后,要确保所有字段和方法的访问权限正确,静态字段和方法正确声明,处理数组操作时避免越界,以及正确转换条件判断和循环结构。 在转换过程中,可能会遇到一些细节问题,比如寄存器的数量和使用方式,需要根据代码逻辑合理分配局部变量。同时,处理异常和日志记录时,要确保与原Smali代码的行为一致。 完成转换后,还需要进行测试,确保Java代码的功能与原始Smali代码一致,特别是在处理图像解码、颜色深度转换和块处理等方面。</think>以下是将 Smali 代码转换为准确无误的 Java 代码: ```java package com.x.kvm.cl.kvm; import com.x.base.ioc.Ioc; import com.x.base.log.Logger; import com.x.base.log.Log; import java.awt.Dimension; @AnnoBeanAttachToIoc @AnnoIocBean(beanName = "Decode") public class Decode { public static final int IMG_BIT_USE = 0xf; public static final int MAX_FILE_LEN = 0x800000; public static final int SRC_BUF_LEN = 0x63e700; private int block_x_num; private int block_y_num; private int[] colorSet = new int[2]; private int color_depth; private int[] dstBuf; private int frame_count; private int height; private int index_x; private int index_y; private Ioc ioc; private int len; private int offset_byte; private int[] posTable = new int[0x400]; private int real_height; private int real_width; private int slice_x; private int slice_y; private byte[] srcBuf; private int width; public Decode() { this.ioc = null; this.colorSet = new int[2]; this.posTable = new int[0x400]; this.slice_x = 0; this.slice_y = 0; } public final int GETPOS(int s, int i) { if (i < 0) return 0; if (i > 0x3ff) return 0; int[] table = posTable; int val = table[i] + s; if (val <= 0) return 0; table = posTable; return table[i] + s; } public Dimension curRes() { return new Dimension(real_width, real_height); } public int decode_init(int width, int height, byte[] src_buf, int[] dst_buf) { this.srcBuf = src_buf; this.dstBuf = dst_buf; this.real_height = height; if (this.real_height % 0x20 != 0) { this.real_height += (0x20 - (this.real_height % 0x20)); } this.height = this.real_height; this.real_width = width; if (this.real_width % 0x20 != 0) { this.real_width += (0x20 - (this.real_width % 0x20)); } this.width = this.real_width; this.block_x_num = this.width / 0x20; this.block_y_num = this.height / 0x20; this.index_x = 0; this.index_y = 0; this.frame_count = 0; this.colorSet[0] = 0; this.colorSet[1] = 0; this.color_depth = 0xf; init_pos_table(); return 0; } // 其他方法如 decode_single_block、decode_single_frame 等按同样方式转换... } ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值