1/* 2Copyright (c) 2011 Stanislav Vitvitskiy 3 4Permission is hereby granted, free of charge, to any person obtaining a copy of this 5software and associated documentation files (the "Software"), to deal in the Software 6without restriction, including without limitation the rights to use, copy, modify, 7merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 8permit persons to whom the Software is furnished to do so, subject to the following 9conditions: 10 11The above copyright notice and this permission notice shall be included in all copies or 12substantial portions of the Software. 13 14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 15INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 16PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 17FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 18TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE 19OR OTHER DEALINGS IN THE SOFTWARE. 20*/ 21package com.googlecode.mp4parser.h264; 22 23import java.nio.ShortBuffer; 24 25public class Debug { 26 public final static void print8x8(int[] output) { 27 int i = 0; 28 for (int x = 0; x < 8; x++) { 29 for (int y = 0; y < 8; y++) { 30 System.out.printf("%3d, ", output[i]); 31 i++; 32 } 33 System.out.println(); 34 } 35 } 36 37 public final static void print8x8(short[] output) { 38 int i = 0; 39 for (int x = 0; x < 8; x++) { 40 for (int y = 0; y < 8; y++) { 41 System.out.printf("%3d, ", output[i]); 42 i++; 43 } 44 System.out.println(); 45 } 46 } 47 48 public final static void print8x8(ShortBuffer output) { 49 for (int x = 0; x < 8; x++) { 50 for (int y = 0; y < 8; y++) { 51 System.out.printf("%3d, ", output.get()); 52 } 53 System.out.println(); 54 } 55 } 56 57 public static void print(short[] table) { 58 int i = 0; 59 for (int x = 0; x < 8; x++) { 60 for (int y = 0; y < 8; y++) { 61 System.out.printf("%3d, ", table[i]); 62 i++; 63 } 64 System.out.println(); 65 } 66 } 67 68 public static void trace(String format, Object... args) { 69 // System.out.printf("> " + format + "\n", args); 70 } 71 72 public final static boolean debug = false; 73 74 public static void print(int i) { 75 if (debug) 76 System.out.print(i); 77 } 78 79 public static void print(String string) { 80 if (debug) 81 System.out.print(string); 82 } 83 84 public static void println(String string) { 85 if (debug) 86 System.out.println(string); 87 } 88} 89