블로그 이미지
안녕1999

카테고리

전체 (3067)
자바스크립트 (20)
안드로이드 (14)
WebGL (4)
변비 (17)
정치,경제 (35)
C언어,ARM (162)
컴퓨터(PC, Note Book, 윈.. (41)
전자회로, PCB (27)
유머,안웃긴,GIF,동영상 (118)
국부론60 (71)
모듈(PCB) (3)
건강 (2)
FreeCAD (25)
PADS (43)
퇴직,퇴사,구직,취업 활동 (3)
C# (86)
엑셀 (8)
워드 (0)
LabView (6)
레고 (30)
FPGA (0)
Total
Today
Yesterday

달력

« » 2024.5
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

공지사항

최근에 올라온 글

NDK에서 화면을 더블 버퍼링하려면?

How to Render Image Buffer in Android NDK Native Code

ANativeWindow* window = ANativeWindow_fromSurface(env, javaSurface);

ANativeWindow_Buffer buffer;
if (ANativeWindow_lock(window, &buffer, NULL) == 0) {
  memcpy(buffer.bits, pixels,  w * h * 2);
  ANativeWindow_unlockAndPost(window);
}

ANativeWindow_release(window);

일반적으로 위의 방법을 사용한다.
그런데, 문제가 좀 있다.
본인이 확인한 화면은 2장이 아니라, 4장이었다.
4장을 내 마음대로 골라서, swap하질 못한다.
무조건 순차적으로 강제 버퍼링(swap)되어 진다.
2장만 있으면, swap할 수 있는데, 4장이니, 메모리 낭비가 발생한다.

또한 swap기능을 사용 하기위해서는
1) 화면 전체를 새로 그리던가,
2) 별도의 화면 메모리를 할당하여, 그리고, 필요한 부분만 업데이트 해주면 되나,
   문제가 많다.

1), 2)번 모두 처리비용이 비싸다. 비효율적이라는 말이다.
왜 일반적인 sawp기능이 왜 없는지 의문스럽다.


Graphics architecture


Posted by 안녕1999
, |

디버깅 정보가 들어가니, apk파일이 3M정도 였는데, 디버깅 안함으로 설정하니, 174k로 줄어드네요.

AndroidManifest.xml 파일에서

android:debuggable="false"

Posted by 안녕1999
, |

화면을 그릴때, 사용되는 픽셀정보 구조체

관련함수 : ANativeWindow_lockANativeWindow_unlockAndPost

native_window.h


typedef struct ANativeWindow_Buffer {

    // The number of pixels that are show horizontally.

    int32_t width;


    // The number of pixels that are shown vertically.

    int32_t height;


    // The number of *pixels* that a line in the buffer takes in

    // memory.  This may be >= width.

    int32_t stride; //1줄당 픽셀수


    // The format of the buffer.  One of WINDOW_FORMAT_*

    int32_t format;//WINDOW_FORMAT_RGB_565


    // The actual bits.

    void* bits;

    

    // Do not touch.

    uint32_t reserved[6];

} ANativeWindow_Buffer;

Posted by 안녕1999
, |

Looper

키보드, 모션(터치) 등을 처리하는 기능.

..\Android\android-ndk-r13b\platforms\android-12\arch-x86\usr\include\android\looper.h

/**

 * For callback-based event loops, this is the prototype of the function

 * that is called when a file descriptor event occurs.

 * It is given the file descriptor it is associated with,

 * a bitmask of the poll events that were triggered (typically ALOOPER_EVENT_INPUT),

 * and the data pointer that was originally supplied.

 *

 * Implementations should return 1 to continue receiving callbacks, or 0

 * to have this file descriptor and callback unregistered from the looper.

 */

typedef int (*ALooper_callbackFunc)(int fd, int events, void* data);


/**

 * Waits for events to be available, with optional timeout in milliseconds.

 * Invokes callbacks for all file descriptors on which an event occurred.

 *

 * If the timeout is zero, returns immediately without blocking.

 * If the timeout is negative, waits indefinitely until an event appears.

 *

 * Returns ALOOPER_POLL_WAKE if the poll was awoken using wake() before

 * the timeout expired and no callbacks were invoked and no other file

 * descriptors were ready.

 *

 * Returns ALOOPER_POLL_CALLBACK if one or more callbacks were invoked.

 *

 * Returns ALOOPER_POLL_TIMEOUT if there was no data before the given

 * timeout expired.

 *

 * Returns ALOOPER_POLL_ERROR if an error occurred.

 *

 * Returns a value >= 0 containing an identifier if its file descriptor has data

 * and it has no callback function (requiring the caller here to handle it).

 * In this (and only this) case outFd, outEvents and outData will contain the poll

 * events and data associated with the fd, otherwise they will be set to NULL.

 *

 * This method does not return until it has finished invoking the appropriate callbacks

 * for all file descriptors that were signalled.

 */

int ALooper_pollOnce(int timeoutMillis, int* outFd, int* outEvents, void** outData);


/**

 * Like ALooper_pollOnce(), but performs all pending callbacks until all

 * data has been consumed or a file descriptor is available with no callback.

 * This function will never return ALOOPER_POLL_CALLBACK.

 */

int ALooper_pollAll(int timeoutMillis, int* outFd, int* outEvents, void** outData);






   // loop waiting for stuff to do.

//on_program_start();

while (1) {

// Read all pending events.

int ident;

int events;

struct android_poll_source* source;


// If not animating, we will block forever waiting for events.

// If animating, we loop until all events are read, then continue

// to draw the next frame of animation.

while ((ident=ALooper_pollAll(engine.animating ? 0 : -1, NULL, &events,

(void**)&source)) >= 0) {


// Process this event.

if (source != NULL) {

source->process(state, source);

}


// Check if we are exiting.

if (state->destroyRequested != 0) {

DEBUG_socket_printf("Engine thread destroy requested!\r\n");

//engine_term_display(&engine);

goto end;//return;

}

}


if (engine.animating)

{

engine_draw_frame(&engine);

}

}

Posted by 안녕1999
, |

Android API level XX
레벨 = 추가기능
"사용하고자 하는 기능"이 있는 레벨 이상으로 설정해주어야 한다.
예) 미디어플레이어 제작하려면, 레벨14이상 필요하다.
자세한 내용은 Android NDK Native APIs 에서 확인가능하다.
또한, 각 API레벨을 사용하기 위해서는 Android.mk 파일에 아래와 같은 내용을 추가해주어야 한다. 그러나, 자동으로 링크가 된다고 설명되어 있다. 어느것이 맞는지는 모르겠음.
For all API levels, the build system automatically links the standard C libraries, the standard C++ libraries, real-time extensions, and pthread; you do not need to include them when defining your LOCAL_LDLIBS variable. For more information about the C and C++ libraries, see Android API level 3.
LOCAL_LDLIBS += -lOpenMAXAL        //Android API level 14


Android API level 9
Android native application APIs
Starting from API level 9, you can write an entire Android app with native code, without using any Java.
아래의 경로에 가면, 안드로이드 NDK(JNI)헤더파일이 있다.
..\ANDROID\ANDROID-NDK-R13B\platforms\android-12\arch-x86\usr\include\android

api-level.h
asset_manager.h
asset_manager_jni.h
bitmap.h
configuration.h
dir.bat
input.h
keycodes.h
list.txt
log.h
looper.h
native_activity.h
native_window.h
native_window_jni.h
obb.h
rect.h
sensor.h
storage_manager.h
window.h

Android API level 14

The NDK provides the following APIs for developing native code that runs on Android 4.0 system images and above.

OpenMAX AL






Vulkan - Industry Forged - Khronos Group

https://www.khronos.org/vulkan/
이 페이지 번역하기
Vulkan is a new generation graphics and compute API that provides high-efficiency, cross-platform access to modern GPUs used in a wide variety of devices ...

벌컨 (API) - 위키백과, 우리 모두의 백과사전

https://ko.wikipedia.org/wiki/벌컨_(API)
벌컨(Vulkan)은 오버헤드가 적은 크로스 플랫폼 3D 그래픽스 및 컴퓨팅 API이다. 이는 GDC 2015에서 크로노스 그룹에 의해 처음으로 소개되었다. 초기의 Vulkan ...

Vulkan (API) - Wikipedia

https://en.wikipedia.org/wiki/Vulkan_(API)
이 페이지 번역하기
Vulkan is a low-overhead, cross-platform 3D graphics and compute API first announced at GDC 2015 by the Khronos Group. The Vulkan API was initially ...


Posted by 안녕1999
, |

안드로이드 개발 폴더에 보면, assets 폴더가 있다.

assets에 파일을 넣으면, apk파일에 포함이 되어, AssetManager로 접근할 수 있다.

- 파일크기는 (기본) 1M이하(압축안된 상태. 큰파일도 된다.)

- jpg,png,mp3,wav,. ... 이외의 확장자 파일은 자동으로 압축되어진다.




ㅈㅅㄹ :: 안드로이드 Asset 사용에 있어 몇가지...

zeph1e.tistory.com/49
2011. 8. 5. - 아시는 분들은 다 아시겠지만 asset을 패키지에 포함시키는 방법은 쉽다. ... 안드로이드 SDK에서 apk를 묶을 때, aapt는 몇 가지 확장자를 제외하고 ...

APK Expansion Files | Android Developers

https://developer.android.com/google/play/expansion-files.html
이 페이지 번역하기
Google Play currently requires that your APK file be no more than 100MB. For most applications, this is plenty of space for all the application's code and assets.


Posted by 안녕1999
, |

keystore 파일은 일종의 인증서 파일이다.(사이닝(signing)을 위해 필요함. 서류에 사인하다.)

*.apk 프로그램(앱. APP) 설치할때 검사되며, 만기 이후에는 설치가 안된다.

구글 스토어에 올려 배포하려면 꼭 필요하다.

keystore 파일을 잃어 버리면, 프로그램을 업데이트 할 수 없다.

프로그램 제작자 본인이라는 인증서이다.

자바의 keytool.exe 프로그램을 사용하여 생성할 수 있다.


C:\Program Files\Java\jdk1.8.0_121\bin\keytool.exe

키 및 인증서 관리 툴


명령:


 -certreq            인증서 요청을 생성합니다.

 -changealias        항목의 별칭을 변경합니다.

 -delete             항목을 삭제합니다.

 -exportcert         인증서를 익스포트합니다.

 -genkeypair         키 쌍을 생성합니다.

 -genseckey          보안 키를 생성합니다.

 -gencert            인증서 요청에서 인증서를 생성합니다.

 -importcert         인증서 또는 인증서 체인을 임포트합니다.

 -importpass         비밀번호를 임포트합니다.

 -importkeystore     다른 키 저장소에서 하나 또는 모든 항목을 임포트합니다.

 -keypasswd          항목의 키 비밀번호를 변경합니다.

 -list               키 저장소의 항목을 나열합니다.

 -printcert          인증서의 콘텐츠를 인쇄합니다.

 -printcertreq       인증서 요청의 콘텐츠를 인쇄합니다.

 -printcrl           CRL 파일의 콘텐츠를 인쇄합니다.

 -storepasswd        키 저장소의 저장소 비밀번호를 변경합니다.


command_name 사용법에 "keytool -command_name -help" 사용 



씹어먹는 블로그 :: keystore 만들기


사인된것인지 확인하려면, fingerprint 사용.

사인한 키스토어(keystore) 확인하기 – Dog발자



keytool -genkey -alias year100 -keyalg RSA -validity 36500 -keystore year100.keystore

키 저장소 비밀번호 입력:

새 비밀번호 다시 입력:

일치하지 않습니다. 다시 시도하십시오.

키 저장소 비밀번호 입력:

새 비밀번호 다시 입력:

이름과 성을 입력하십시오.

  [Unknown]:  year100

조직 단위 이름을 입력하십시오.

  [Unknown]:  year100

조직 이름을 입력하십시오.

  [Unknown]:  year100

구/군/시 이름을 입력하십시오?

  [Unknown]:  Seoul

시/도 이름을 입력하십시오.

  [Unknown]:  Seoul

이 조직의 두 자리 국가 코드를 입력하십시오.

  [Unknown]:  KR

CN=year100, OU=year100, O=year100, L=Seoul, ST=Seoul, C=KR이(가) 맞습니까?

  [아니오]:  y


<year100>에 대한 키 비밀번호를 입력하십시오.

        (키 저장소 비밀번호와 동일한 경우 Enter 키를 누름):


현재 폴더에 "year100.keystore"파일이 생성됨


validity : 일(Day). 20년 이상 하라고 권고. 만기후에는 사용은 되나, 설치가 안된다.

비밀번호 : 앱등록시 필요. 키입력 표시로, *등이 나오지 않는다.(안보임)


Code Dragon :: [플레이스토어, 구글스토어] 마켓에 앱 등록하기(앱 출시)




'안드로이드' 카테고리의 다른 글

안드로이드 - assets 폴더  (0) 2017.02.05
ant로 안드로이드 앱을 자동으로 빌드하자  (0) 2017.02.04
안드로이드 NDK 컴파일 환경 구축2  (0) 2017.01.28
안드로이드 AssetManager  (0) 2016.11.29
APK파일  (0) 2016.11.29
Posted by 안녕1999
, |

2번째 도전

gcc컴파일러로 C소스파일을 컴파일 할 수 는 있지만, 링크와 APK파일에 넣는것은 할 수 없어, 안드로이드 스튜디오 설치.

이클립스 개발환경도 있으나, 안드로이드 스튜디오가 대세인듯함.

그러나, 설치부터, 실행까지, 너무나 무겁다.

(이클립스는 더이상 업데이트 안되니, 안드로이드 스튜디오를 사용하란다.)


1) 컴파일러(개발환경) 다운로드

지난번에는 이클립스로 해서, 용량이 작았는데, 

안드로이드 스튜디오로 하려니, 용량이 너무 크다.(약 1.7G)

https://developer.android.com/studio/index.html?hl=ko

https://developer.android.com/studio/index.html?hl=ko#win-bundle


2) JDK 설치

안드로이드 스튜디오 실행하면, 나오는 에러 메세지

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

 Java SE Development Kit 8u121
You must accept the Oracle Binary Code License Agreement for Java SE to download this software.
  Accept License Agreement       Decline License Agreement
Product / File DescriptionFile SizeDownload


Windows x86189.36 MB  jdk-8u121-windows-i586.exe
Windows x64195.51 MB  jdk-8u121-windows-x64.exe

윈도우 XP에서 설치하면 아래의 메세지가 나옴.

설치는 계속할 수 있음.

설치가 다 될때쯤, 또 에러 메세지가 나옴.

계속 진행.

JDK설치후, 안드로이드 스튜디오 실행 -> 안드로이드 스튜디오 Setup, 다운로딩 진행.

처음 실행해서 설치(다운로드)하는데, 왜이리 오래걸리는지...ㅠ ㅠ


3) NDK(라이브러리) 다운로드

https://developer.android.com/ndk/downloads/index.html

PlatformPackageSize (Bytes)SHA1 Checksum
Windows 32-bitandroid-ndk-r13b-windows-x86.zip6204615444eb1288b1d4134a9d6474eb247f0448808d52408

윈도우용 NDK?? (NDK는 OS독립적이지 않은가?)
=> NDK는 C소스파일을 리눅스의 *.so(DLL)파일로 컴파일하는 역활을 함.(안드로이드는 리눅스로 만들어졌음)
    C소스파일을 *.so형태로 컴파일해서, APK파일에 넣는다.
    안드로이드 기기(휴대폰)마다 사용하는 CPU가 다르므로, 각 CPU별로 컴파일러가 있어야 한다.
    NDK에는 각 CPU별로 컴파일러(툴체인)도 들어 있다.
    참고 : 2016.11.29 APK파일


4) NDK 샘플 소스 다운로드

https://github.com/googlesamples/android-ndk

https://github.com/googlesamples/android-ndk/archive/master.zip

'안드로이드' 카테고리의 다른 글

안드로이드 - assets 폴더  (0) 2017.02.05
ant로 안드로이드 앱을 자동으로 빌드하자  (0) 2017.02.04
안드로이드 - keystore 파일  (0) 2017.02.04
안드로이드 AssetManager  (0) 2016.11.29
APK파일  (0) 2016.11.29
Posted by 안녕1999
, |
갤럭시7 2016에서는 전화번호를 배경화면에 직접 만들 수 없습니다.
대신, 위젯으로 만들 수 있습니다.
배경화면의 빈곳을 누르고 있으면, 아래의 편집화면이 나옵니다.
(빈곳이 없으면 안되요)

위젯을 선택하고, 연락처 전화번호 선택,

다이렉트 전화를 끌어서, 배경화면에 놓으면, 전화번호를 선택할 수 있습니다.

배경화면에 전화바로걸기 아이콘이 생겼습니다.

Posted by 안녕1999
, |
설정 -> 내 디바이스 -> 소리

음질최적화

소리가 들리는지 물어보는 화면이 나온다.
이 과정은 여러 주파수 대역에서 소리가 잘 들리는지를 확인하는 과정이다.

질문이 끝나면, 아래와 같은 화면이 나온다.

전체적으로 음량이 커졌다.
높은 주파수대역(삐삐삐)이 소리가 좀더 크다.

이어폰마다 주파수 대역별로 재생가능한 음량이 다르므로, 이어폰이 바뀌면, 다시 설정해야한다.

설정 후에는 이전보다 소리가 더 커진것을 느낄 수 있다.
Posted by 안녕1999
, |

최근에 달린 댓글

글 보관함