Skip to content

Commit

Permalink
add #define flag to enable/disable bg thread
Browse files Browse the repository at this point in the history
  • Loading branch information
roman10 committed Jan 2, 2012
1 parent 149da49 commit 59690cd
Show file tree
Hide file tree
Showing 19 changed files with 537 additions and 538 deletions.
1 change: 1 addition & 0 deletions .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
12 changes: 9 additions & 3 deletions jni/andzop.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,17 +160,19 @@ JNIEXPORT void JNICALL Java_feipeng_andzop_render_RenderView_naInit(JNIEnv *pEnv
l_mbW = (gVideoCodecCtxList[l_i]->width + 15) / 16;
allocate_selected_decoding_fields(l_i, l_mbH, l_mbW);
}
#ifdef BG_DUMP_THREAD
LOGI(10, "initialize dumping threads, current video index %d", gCurrentDecodingVideoFileIndex);
gDepDumpThreadList = (pthread_t*)malloc(gNumOfVideoFiles *sizeof(pthread_t));
gDumpThreadParams = (DUMP_DEP_PARAMS *)malloc(sizeof(DUMP_DEP_PARAMS)*gNumOfVideoFiles);
for (l_i = 0; l_i < gNumOfVideoFiles; ++l_i) {
/*start a background thread for dependency dumping*/
//start a background thread for dependency dumping
gDumpThreadParams[l_i].videoFileIndex = l_i;
if (pthread_create(&gDepDumpThreadList[l_i], NULL, dump_dependency_function, (void *)&gDumpThreadParams[l_i])) {
LOGE(1, "Error: failed to create a native thread for dumping dependency");
}
LOGI(10, "tttttt: dependency dumping thread started! tttttt");
}
#endif //for BG_DUMP_THREAD
#endif
LOGI(10, "initialization done, current video index %d", gCurrentDecodingVideoFileIndex);
}
Expand Down Expand Up @@ -268,8 +270,10 @@ JNIEXPORT jint JNICALL Java_feipeng_andzop_render_RenderView_naRenderAFrame(JNIE
/*see if it's a gop start, if so, load the gop info*/
LOGI(10, "--------------gVideoPacketNum = %d; = %d;", gVideoPacketNum, g_decode_gop_num);
if (gVideoPacketNum == 1) {
/*if it's first packet, we load the gop info*/
//TODO:if it's first packet, we load the gop info
#ifdef BG_DUMP_THREAD
wait_get_dependency();
#endif
#ifdef ANDROID_BUILD
sprintf(l_depGopRecFileName, "%s_goprec_gop%d.txt", gVideoFileNameList[gCurrentDecodingVideoFileIndex], g_decode_gop_num);
#else
Expand Down Expand Up @@ -382,8 +386,10 @@ JNIEXPORT jint JNICALL Java_feipeng_andzop_render_RenderView_naRenderAFrame(JNIE
}
gZoomLevelUpdate = 0;
}
//read the gop info for next gop
//TODO: read the gop info for next gop
#ifdef BG_DUMP_THREAD
wait_get_dependency();
#endif
#ifdef ANDROID_BUILD
sprintf(l_depGopRecFileName, "%s_goprec_gop%d.txt", gVideoFileNameList[gCurrentDecodingVideoFileIndex], g_decode_gop_num);
#else
Expand Down
2 changes: 2 additions & 0 deletions jni/dependency.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@

#define SELECTIVE_DECODING //commented: run as normal decoding mode; uncommented: run as selective decoding mode

#define BG_DUMP_THREAD //commented: no background thread running to dump or check

//#define NORM_DECODE_DEBUG //uncommented: dump dependency for normal decoding mode; should be commented at //selective decoding mode
//#define DUMP_SELECTED_MB_MASK //enabled: dump the mask for the mb needed;
//#define DUMP_VIDEO_FRAME_BYTES //enabled: dump the bytes to a binary file
Expand Down
Binary file modified jni/ffmpeg/android/armv7-a/bin/ffmpeg
Binary file not shown.
Binary file modified jni/ffmpeg/android/armv7-a/bin/ffprobe
Binary file not shown.
Binary file modified jni/ffmpeg/android/armv7-a/lib/libavcodec.a
Binary file not shown.
Binary file modified jni/ffmpeg/android/armv7-a/lib/libavformat.a
Binary file not shown.
Binary file modified jni/ffmpeg/android/armv7-a/lib/libavutil.a
Binary file not shown.
Binary file modified jni/ffmpeg/android/armv7-a/lib/libswscale.a
Binary file not shown.
2 changes: 1 addition & 1 deletion jni/ffmpeg/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@
#define CONFIG_BZLIB 0
#define CONFIG_CRYSTALHD 0
#define CONFIG_DCT 0
#define CONFIG_DOC 1
#define CONFIG_DOC 0
#define CONFIG_DWT 0
#define CONFIG_DXVA2 0
#define CONFIG_FASTDIV 1
Expand Down
1,030 changes: 514 additions & 516 deletions jni/ffmpeg/config.log

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions jni/ffmpeg/config.mak
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ INCDIR=$(DESTDIR)${prefix}/include
BINDIR=$(DESTDIR)${prefix}/bin
DATADIR=$(DESTDIR)${prefix}/share/ffmpeg
MANDIR=$(DESTDIR)${prefix}/share/man
SRC_PATH="/home/roman10/Desktop/master/code/AndZop/jni/ffmpeg"
SRC_PATH_BARE=/home/roman10/Desktop/master/code/AndZop/jni/ffmpeg
BUILD_ROOT="/home/roman10/Desktop/master/code/AndZop/jni/ffmpeg"
SRC_PATH="/home/roman10/Desktop/github/AndZop/jni/ffmpeg"
SRC_PATH_BARE=/home/roman10/Desktop/github/AndZop/jni/ffmpeg
BUILD_ROOT="/home/roman10/Desktop/github/AndZop/jni/ffmpeg"
CC_IDENT=gcc 4.4.3 (GCC)
ARCH=arm
CC=/home/roman10/Desktop/android/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc
Expand Down Expand Up @@ -242,7 +242,7 @@ CONFIG_AVFORMAT=yes
!CONFIG_BZLIB=yes
!CONFIG_CRYSTALHD=yes
!CONFIG_DCT=yes
CONFIG_DOC=yes
!CONFIG_DOC=yes
!CONFIG_DWT=yes
!CONFIG_DXVA2=yes
CONFIG_FASTDIV=yes
Expand Down
2 changes: 1 addition & 1 deletion jni/ffmpeg/libavcodec/libavcodec-uninstalled.pc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
prefix=
exec_prefix=
libdir=${pcfiledir}
includedir=/home/roman10/Desktop/master/code/AndZop/jni/ffmpeg
includedir=/home/roman10/Desktop/github/AndZop/jni/ffmpeg

Name: libavcodec
Description: FFmpeg codec library
Expand Down
2 changes: 1 addition & 1 deletion jni/ffmpeg/libavformat/libavformat-uninstalled.pc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
prefix=
exec_prefix=
libdir=${pcfiledir}
includedir=/home/roman10/Desktop/master/code/AndZop/jni/ffmpeg
includedir=/home/roman10/Desktop/github/AndZop/jni/ffmpeg

Name: libavformat
Description: FFmpeg container format library
Expand Down
2 changes: 1 addition & 1 deletion jni/ffmpeg/libavutil/libavutil-uninstalled.pc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
prefix=
exec_prefix=
libdir=${pcfiledir}
includedir=/home/roman10/Desktop/master/code/AndZop/jni/ffmpeg
includedir=/home/roman10/Desktop/github/AndZop/jni/ffmpeg

Name: libavutil
Description: FFmpeg utility library
Expand Down
2 changes: 1 addition & 1 deletion jni/ffmpeg/libswscale/libswscale-uninstalled.pc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
prefix=
exec_prefix=
libdir=${pcfiledir}
includedir=/home/roman10/Desktop/master/code/AndZop/jni/ffmpeg
includedir=/home/roman10/Desktop/github/AndZop/jni/ffmpeg

Name: libswscale
Description: FFmpeg image rescaling library
Expand Down
6 changes: 0 additions & 6 deletions src/feipeng/andzop/Main/ROIOptionsDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,8 @@ public void onCreate(Bundle icicle) {
bar_height = (SeekBar) findViewById(R.id.dialog_roi_options_height_bar);
bar_height.setProgress(ROISettingsStatic.getROIHeight(this.getApplicationContext()));
bar_height.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onStopTrackingTouch(SeekBar seekBar) {}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {}
@Override
public void onProgressChanged(SeekBar seekBar, int progress,
boolean fromUser) {
text_height.setText("ROI Height: " + progress + "%");
Expand All @@ -45,11 +42,8 @@ public void onProgressChanged(SeekBar seekBar, int progress,
bar_width = (SeekBar) findViewById(R.id.dialog_roi_options_width_bar);
bar_width.setProgress(ROISettingsStatic.getROIWidth(this.getApplicationContext()));
bar_width.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onStopTrackingTouch(SeekBar seekBar) {}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {}
@Override
public void onProgressChanged(SeekBar seekBar, int progress,
boolean fromUser) {
text_width.setText("ROI Width: " + progress + "%");
Expand Down
2 changes: 0 additions & 2 deletions src/feipeng/andzop/Main/VideoBrowser2.java
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,6 @@ public void onClick(View v) {
btn_bottommenu4 = (Button) findViewById(R.id.video_browser_btn4);
btn_bottommenu4.setWidth(l_btnWidth);
btn_bottommenu4.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//count the number of entries selected
int l_selected = getNumOfEntriesSelected();
Expand All @@ -433,7 +432,6 @@ public void onClick(View v) {
btn_bottommenu5 = (Button) findViewById(R.id.video_browser_btn5);
btn_bottommenu5.setWidth(l_btnWidth);
btn_bottommenu5.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(mContext, "deleting all txt files", Toast.LENGTH_LONG).show();
//delete all dependency files
Expand Down
4 changes: 2 additions & 2 deletions src/feipeng/andzop/render/RenderView.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ private int naGetNextFrameDelay() {
private String prLastTime;//last profile is displayed
private boolean prStopPlay = false;
private Runnable prDisplayVideoTask = new Runnable() {
@Override public void run() {
public void run() {
if (prStopPlay) {
stopRendering();
return;
Expand Down Expand Up @@ -359,7 +359,7 @@ private void stopRendering() {
}
}
/*the update method is triggered when ZoomState.notifyObservers() is called*/
@Override public void update(Observable observable, Object data) {
public void update(Observable observable, Object data) {
int lZoomLevelUpdate = prZoomState.getZoomLevelUpdate();
if (lZoomLevelUpdate!=0) {
naUpdateZoomLevel(lZoomLevelUpdate);
Expand Down

0 comments on commit 59690cd

Please sign in to comment.