Showing posts with label Android. Show all posts
Showing posts with label Android. Show all posts

Friday, 29 March 2013

Android Command Line Hacks

Android Command Line Hacks

[1] Update Project

Create a new project from existing code,

ANDROID_HOME=/home/prayag/android-sdks/
prayag@prayag:/BirthdayForestGap$ $ANDROID_HOME/tools/android update project --path ../BirthdayForestGap/
Updated local.properties
No project name specified, using Activity name 'BirthdayForestViewController'.
If you wish to change it, edit the first line of build.xml.
Added file ../BirthdayForestGap/build.xml
Updated file ../BirthdayForestGap/proguard-project.txt
It seems that there are sub-projects. If you want to update them
please use the --subprojects parameter.

If you are using android studio in mac, the location of sdk is

λ ls -l /Users/prayagupd/Library/Android/sdk/
total 0
drwxr-xr-x   7 prayagupd  184630988  224 Sep  8 09:08 build-tools
drwxr-xr-x  17 prayagupd  184630988  544 Jan 10  2018 emulator
drwxr-xr-x   6 prayagupd  184630988  192 Jan 10  2018 extras
drwxr-xr-x   3 prayagupd  184630988   96 Jan 10  2018 fonts
drwxr-xr-x   4 prayagupd  184630988  128 Jan 10  2018 licenses
drwxr-xr-x   3 prayagupd  184630988   96 Jan 10  2018 patcher
drwxr-xr-x  19 prayagupd  184630988  608 Jan 21  2019 platform-tools
drwxr-xr-x   7 prayagupd  184630988  224 Nov  9 10:29 platforms
drwxr-xr-x  26 prayagupd  184630988  832 Jun 16  2019 skins
drwxr-xr-x   5 prayagupd  184630988  160 Jun 17  2019 sources
drwxr-xr-x   3 prayagupd  184630988   96 Jan 10  2018 system-images
drwxr-xr-x  14 prayagupd  184630988  448 Jan 10  2018 tools

[2] ASM - Android SDK Manager
prayag@prayag: /BirthdayForestGap$ $ANDROID_HOME/tools/android sdk




prayag@prayag: /BirthdayForestGap$ ps aux | grep android
prayag   13409  2.6  1.9 473456 74852 pts/3    Sl+  22:16   0:20 java
-Xmx256M
-Dcom.android.sdkmanager.toolsdir=/home/prayag/android-sdks/tools
-classpath /home/prayag/android-sdks/tools/lib/sdkmanager.jar:/home/prayag/android-sdks/tools/lib/swtmenubar.jar:/home/prayag/android-sdks/tools/lib/x86/swt.jar com.android.sdkmanager.Main
prayag   13749  0.0  0.0   4400   836 pts/1    S+   22:29   0:00 grep --color=auto android


You can list sdks
ANDROID_HOME=/usr/local/android-studio/sdk
$ $ANDROID_HOME/tools/android list sdk
Refresh Sources:
  Fetching https://dl-ssl.google.com/android/repository/addons_list-2.xml
  Validate XML
  Parse XML
  Fetched Add-ons List successfully
  Refresh Sources
  Fetching URL: https://dl-ssl.google.com/android/repository/repository-8.xml
  Validate XML: https://dl-ssl.google.com/android/repository/repository-8.xml
  Parse XML:    https://dl-ssl.google.com/android/repository/repository-8.xml
  Fetching URL: https://dl-ssl.google.com/android/repository/addon.xml
  Validate XML: https://dl-ssl.google.com/android/repository/addon.xml
  Fetching URL: https://dl-ssl.google.com/android/repository/addon-6.xml
  Validate XML: https://dl-ssl.google.com/android/repository/addon-6.xml
  Parse XML:    https://dl-ssl.google.com/android/repository/addon-6.xml
  Fetching URL: https://dl-ssl.google.com/glass/gdk/addon.xml
  Validate XML: https://dl-ssl.google.com/glass/gdk/addon.xml
  Parse XML:    https://dl-ssl.google.com/glass/gdk/addon.xml
  Fetching URL: https://dl-ssl.google.com/android/repository/extras/intel/addon.xml
  Validate XML: https://dl-ssl.google.com/android/repository/extras/intel/addon.xml
  Parse XML:    https://dl-ssl.google.com/android/repository/extras/intel/addon.xml
  Fetching URL: https://dl-ssl.google.com/android/repository/sys-img/android/sys-img.xml
  Validate XML: https://dl-ssl.google.com/android/repository/sys-img/android/sys-img.xml
  Fetching URL: https://dl-ssl.google.com/android/repository/sys-img/android-wear/sys-img.xml
  Validate XML: https://dl-ssl.google.com/android/repository/sys-img/android-wear/sys-img.xml
  Fetching URL: https://dl-ssl.google.com/android/repository/sys-img/android-tv/sys-img.xml
  Validate XML: https://dl-ssl.google.com/android/repository/sys-img/android-tv/sys-img.xml
  Fetching URL: https://dl-ssl.google.com/android/repository/sys-img/x86/addon-x86.xml
  Validate XML: https://dl-ssl.google.com/android/repository/sys-img/x86/addon-x86.xml
Refresh Sources:
  Fetching URL: https://dl-ssl.google.com/android/repository/addon.xml
  Validate XML: https://dl-ssl.google.com/android/repository/addon.xml
  Fetching URL: https://dl-ssl.google.com/android/repository/sys-img/android/sys-img.xml
  Validate XML: https://dl-ssl.google.com/android/repository/sys-img/android/sys-img.xml
  Fetching URL: https://dl-ssl.google.com/android/repository/sys-img/android-wear/sys-img.xml
  Validate XML: https://dl-ssl.google.com/android/repository/sys-img/android-wear/sys-img.xml
  Fetching URL: https://dl-ssl.google.com/android/repository/sys-img/android-tv/sys-img.xml
  Validate XML: https://dl-ssl.google.com/android/repository/sys-img/android-tv/sys-img.xml
  Fetching URL: https://dl-ssl.google.com/android/repository/sys-img/x86/addon-x86.xml
  Validate XML: https://dl-ssl.google.com/android/repository/sys-img/x86/addon-x86.xml
Refresh Sources:
  Fetching URL: https://dl-ssl.google.com/android/repository/addon.xml
  Validate XML: https://dl-ssl.google.com/android/repository/addon.xml
  Fetching URL: https://dl-ssl.google.com/android/repository/sys-img/android/sys-img.xml
  Validate XML: https://dl-ssl.google.com/android/repository/sys-img/android/sys-img.xml
  Fetching URL: https://dl-ssl.google.com/android/repository/sys-img/android-wear/sys-img.xml
  Validate XML: https://dl-ssl.google.com/android/repository/sys-img/android-wear/sys-img.xml
  Fetching URL: https://dl-ssl.google.com/android/repository/sys-img/android-tv/sys-img.xml
  Validate XML: https://dl-ssl.google.com/android/repository/sys-img/android-tv/sys-img.xml
  Fetching URL: https://dl-ssl.google.com/android/repository/sys-img/x86/addon-x86.xml
  Validate XML: https://dl-ssl.google.com/android/repository/sys-img/x86/addon-x86.xml
Packages available for installation or update: 15
   1- Android SDK Tools, revision 23
   2- Android SDK Platform-tools, revision 20
   3- Documentation for Android SDK, API 19, revision 2
   4- SDK Platform Android 4.4.2, API 19, revision 3
   5- Samples for SDK API 19, revision 5
   6- Samples for SDK API 18, revision 1
   7- Samples for SDK API 17, revision 1
   8- Samples for SDK API 16, revision 1
   9- Samples for SDK API 15, revision 2
  10- Samples for SDK API 14, revision 2
  11- Samples for SDK API 13, revision 1
  12- Samples for SDK API 12, revision 1
  13- Samples for SDK API 11, revision 1
  14- Samples for SDK API 10, revision 1
  15- Glass Development Kit Preview, Android API 19, revision 8



[3] AVD(Virtual Device) Manager
prayag@prayag: /BirthdayForestGap$ $ANDROID_HOME/tools/android avd




$ANDROID_HOME//tools/android list targets | grep android-23

[3.1] Start any of the AVDs from the list already created. Same thing can be achieved through 
prayag@prayag: /BirthdayForestGap$ $ANDROID_HOME/tools/emulator -avd AVD -netspeed full -netdelay none
emulator: emulator window was out of view and was recentered



[3.2] List AVD confs
$ ls -l ~/.android/avd/
total 40
drwxrwxr-x 2 prayag prayag 4096 May 14  2013 avd.avd
-rw-rw-r-- 1 prayag prayag   72 Jul 20  2012 avd.ini
drwxrwxr-x 2 prayag prayag 4096 Jun 23  2013 FroyoVD.avd
-rw-rw-r-- 1 prayag prayag   60 Apr 28  2013 FroyoVD.ini
drwxrwxr-x 2 prayag prayag 4096 Sep 28  2012 Google31TV.avd
-rw-rw-r-- 1 prayag prayag   84 Aug  9  2012 Google31TV.ini
drwxrwxr-x 2 prayag prayag 4096 Apr 21  2013 HC32.avd
-rw-rw-r-- 1 prayag prayag   58 Sep 11  2012 HC32.ini
drwxrwxr-x 2 prayag prayag 4096 Dec 31 23:50 Kitkat.avd
-rw-rw-r-- 1 prayag prayag  112 Dec 25 23:59 Kitkat.ini

[4] ant build

REFERENCES
[1] How do I launch the Android emulator from the command line?,
http://stackoverflow.com/a/4974695/432903

[2] http://developer.android.com/tools/building/building-cmdline.html

Friday, 28 September 2012

ERROR: backend_impl.cc:1097

Problem
The error I am getting while programming on android WebView is as following :

09-28 18:16:18.342: E/chromium(576): external/chromium/net/disk_cache/backend_impl.cc:1097: [0928/181618:ERROR:backend_impl.cc(1097)] Critical error found -8
09-28 18:16:20.242: W/chromium(576): external/chromium/net/disk_cache/storage_block-inl.h:119: [0928/181620:WARNING:storage_block-inl.h(119)] Failed data load.
09-28 18:16:20.262: W/chromium(576): external/chromium/net/disk_cache/storage_block-inl.h:119: [0928/181620:WARNING:storage_block-inl.h(119)] Failed data load.
09-28 18:16:20.273: W/chromium(576): external/chromium/net/disk_cache/storage_block-inl.h:119: [0928/181620:WARNING:storage_block-inl.h(119)] Failed data load.
09-28 18:16:20.312: W/chromium(576): external/chromium/net/disk_cache/storage_block-inl.h:119: [0928/181620:WARNING:storage_block-inl.h(119)] Failed data load.
09-28 18:16:20.392: E/chromium(576): external/chromium/net/disk_cache/entry_impl.cc:830: [0928/181620:ERROR:entry_impl.cc(830)] Failed to save user data
09-28 18:16:20.392: E/chromium(576): external/chromium/net/disk_cache/entry_impl.cc:830: [0928/181620:ERROR:entry_impl.cc(830)] Failed to save user data

My WebView Java code is :

    webView = (WebView) findViewById(R.id.webview);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setPluginsEnabled(true);
webView.getSettings().setLoadWithOverviewMode(true);
webView.getSettings().setUseWideViewPort(true);
Log.i(TAG, "" + url);
webView.loadUrl(url);

Researching on Google
While searching for the error with keyword : ERROR: backend_impl.cc:1097 on google, got nothing more helpful than the source code of the file backend_impl.cc with the code snippet at line number 1097 :
if (new_eviction_) {
    CACHE_UMA(PERCENTAGE, "FirstResurrectRatio", 0, stats_.GetResurrectRatio());
    CACHE_UMA(PERCENTAGE, "FirstNoUseRatio", 0,
              data_->header.lru.sizes[0] * 100 / data_->header.num_entries);
    CACHE_UMA(PERCENTAGE, "FirstLowUseRatio", 0,
              data_->header.lru.sizes[1] * 100 / data_->header.num_entries);
    CACHE_UMA(PERCENTAGE, "FirstHighUseRatio", 0,
              data_->header.lru.sizes[2] * 100 / data_->header.num_entries);
  }

Actually the whole block of code FirstEviction() is

void BackendImpl::FirstEviction() {
  DCHECK(data_->header.create_time);
  if (!GetEntryCount())
    return;  // This is just for unit tests.

  Time create_time = Time::FromInternalValue(data_->header.create_time);
  CACHE_UMA(AGE, "FillupAge", 0, create_time);

  int64 use_time = stats_.GetCounter(Stats::TIMER);
  CACHE_UMA(HOURS, "FillupTime", 0, static_cast<int>(use_time / 120));
  CACHE_UMA(PERCENTAGE, "FirstHitRatio", 0, stats_.GetHitRatio());

  if (!use_time)
    use_time = 1;
  CACHE_UMA(COUNTS_10000, "FirstEntryAccessRate", 0,
            static_cast<int>(data_->header.num_entries / use_time));
  CACHE_UMA(COUNTS, "FirstByteIORate", 0,
            static_cast<int>((data_->header.num_bytes / 1024) / use_time));

  int avg_size = data_->header.num_bytes / GetEntryCount();
  CACHE_UMA(COUNTS, "FirstEntrySize", 0, avg_size);

  int large_entries_bytes = stats_.GetLargeEntriesSize();
  int large_ratio = large_entries_bytes * 100 / data_->header.num_bytes;
  CACHE_UMA(PERCENTAGE, "FirstLargeEntriesRatio", 0, large_ratio);

  if (new_eviction_) {
    CACHE_UMA(PERCENTAGE, "FirstResurrectRatio", 0, stats_.GetResurrectRatio());
    CACHE_UMA(PERCENTAGE, "FirstNoUseRatio", 0,
              data_->header.lru.sizes[0] * 100 / data_->header.num_entries);
    CACHE_UMA(PERCENTAGE, "FirstLowUseRatio", 0,
              data_->header.lru.sizes[1] * 100 / data_->header.num_entries);
    CACHE_UMA(PERCENTAGE, "FirstHighUseRatio", 0,
              data_->header.lru.sizes[2] * 100 / data_->header.num_entries);
  }

  stats_.ResetRatios();
}

But no enough time to hack more on the code, so moving ahead at the moment.

Sunday, 23 September 2012

leaked window that was originally added here


Snippet of my AddRideActivity.java is

private boolean YES = false;

AlertDialog.Builder builder = new AlertDialog.Builder(
AddRideActivity.this);
builder.setTitle("Add Suspension Settings")
.setMessage(Configuration.ADD_SUSPENSION_SETTINGS)
.setCancelable(true)
.setPositiveButton("Yes",
new DialogInterface.OnClickListener() {
@Override
public void onClick(
DialogInterface dialog, int arg1) {
YES = false;
dialog.dismiss();
}
})
.setNegativeButton("Later",
new DialogInterface.OnClickListener() {

@Override
public void onClick(
DialogInterface dialog,
int which) {
// startActivity to
// HomeActivity.class
dialog.dismiss();

}
});
AlertDialog myAlertDialog = builder.create();
myAlertDialog.show();


if (!YES) {
Toast.makeText(getApplicationContext(),
"Ride Successfully Added", Toast.LENGTH_SHORT)
.show();
AddRideActivity.this.setResult(RESULT_OK);
AddRideActivity.this.finish();
} else {
// FIXME AddRideActivity return Ride after added to db
}


But I'm getting following error :


09-23 23:08:43.086: E/WindowManager(828): Activity com.twomonkers.mxsuspensionlite.AddRideActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@44f02830 that was originally added here
09-23 23:08:43.086: E/WindowManager(828): android.view.WindowLeaked: Activity com.twomonkers.mxsuspensionlite.AddRideActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@44f02830 that was originally added here
09-23 23:08:43.086: E/WindowManager(828): at android.view.ViewRoot.<init>(ViewRoot.java:247)
09-23 23:08:43.086: E/WindowManager(828): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:148)
09-23 23:08:43.086: E/WindowManager(828): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
09-23 23:08:43.086: E/WindowManager(828): at android.view.Window$LocalWindowManager.addView(Window.java:424)
09-23 23:08:43.086: E/WindowManager(828): at android.app.Dialog.show(Dialog.java:241)
09-23 23:08:43.086: E/WindowManager(828): at com.twomonkers.mxsuspensionlite.AddRideActivity$6.onClick(AddRideActivity.java:291)
09-23 23:08:43.086: E/WindowManager(828): at android.view.View.performClick(View.java:2408)
09-23 23:08:43.086: E/WindowManager(828): at android.view.View$PerformClick.run(View.java:8816)
09-23 23:08:43.086: E/WindowManager(828): at android.os.Handler.handleCallback(Handler.java:587)
09-23 23:08:43.086: E/WindowManager(828): at android.os.Handler.dispatchMessage(Handler.java:92)
09-23 23:08:43.086: E/WindowManager(828): at android.os.Looper.loop(Looper.java:123)
09-23 23:08:43.086: E/WindowManager(828): at android.app.ActivityThread.main(ActivityThread.java:4627)
09-23 23:08:43.086: E/WindowManager(828): at java.lang.reflect.Method.invokeNative(Native Method)
09-23 23:08:43.086: E/WindowManager(828): at java.lang.reflect.Method.invoke(Method.java:521)
09-23 23:08:43.086: E/WindowManager(828): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
09-23 23:08:43.086: E/WindowManager(828): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
09-23 23:08:43.086: E/WindowManager(828): at dalvik.system.NativeStart.main(Native Method)


Solution
I changed the above code as following :

AlertDialog.Builder builder = new AlertDialog.Builder(
AddRideActivity.this);
builder.setTitle("Add Suspension Settings")
.setMessage(Configuration.ADD_SUSPENSION_SETTINGS)
.setCancelable(true)
.setPositiveButton("Yes",
new DialogInterface.OnClickListener() {
@Override
public void onClick(
DialogInterface dialog, int arg1) {

dialog.dismiss();

Toast.makeText(
getApplicationContext(),
"Ride Successfully Added",
Toast.LENGTH_SHORT).show();
Intent intent = new Intent(
AddRideActivity.this,
AddSuspensionActivity.class);
intent.putExtra("RIDE_ID", rideId);
startActivity(intent);

}
})
.setNegativeButton("Later",
new DialogInterface.OnClickListener() {

@Override
public void onClick(
DialogInterface dialog,
int which) {
// startActivity to
// HomeActivity.class
dialog.dismiss();
Toast.makeText(
getApplicationContext(),
"Ride Successfully Added",
Toast.LENGTH_SHORT).show();
AddRideActivity.this
.setResult(RESULT_OK);
AddRideActivity.this.finish();
}
});
AlertDialog myAlertDialog = builder.create();
myAlertDialog.show();

References
1 - http://stackoverflow.com/questions/2850573/activity-has-leaked-window-that-was-originally-added

The solution is to call dismiss() on the Dialog you created in AddRideActivity.java before exiting the Activity, e.g. in onPause().
Views have a reference to their parent Context (taken from constructor argument). If you leave an Activity without destroying Dialogs and other dynamically created Views, they still hold this reference to your Activity (if you created with this as Context: like new ProgressDialog(this)), so it cannot be collected by the GC, causing a memory leak.

Sunday, 22 July 2012

ARMAssembler generated scanline__

I normolly get the message
generated scanline__00000077:03515104_00000000_00000000 [ 33 ipp] (47 ins) at [0x388750:0x38880c] in 712163 ns in logcat view, android.

While searching for ARMAssembler generated scanline__ on google I got the following results referring to scanline.cpp.
http://source-android.frandroid.com/system/core/libpixelflinger/scanline.cpp
or
http://gitorious.org/android-enablement/system-core/blobs/6090dacd1894429baaf13f7b30b2f6e9e2c1617f/libpixelflinger/scanline.cpp

The part of the code is like this


/* libs/pixelflinger/scanline.cpp
**
** Copyright 2006-2011, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License"); 
** you may not use this file except in compliance with the License. 
** You may obtain a copy of the License at 
**
**     http://www.apache.org/licenses/LICENSE-2.0 
**
** Unless required by applicable law or agreed to in writing, software 
** distributed under the License is distributed on an "AS IS" BASIS, 
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
** See the License for the specific language governing permissions and 
** limitations under the License.
*/


#define LOG_TAG "pixelflinger"

#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#include <cutils/memory.h>
#include <cutils/log.h>

#include "buffer.h"
#include "scanline.h"

#include "codeflinger/CodeCache.h"
#include "codeflinger/GGLAssembler.h"
#include "codeflinger/ARMAssembler.h"
//#include "codeflinger/ARMAssemblerOptimizer.h"

// ----------------------------------------------------------------------------

#define ANDROID_CODEGEN_GENERIC     0   // force generic pixel pipeline
#define ANDROID_CODEGEN_C           1   // hand-written C, fallback generic 
#define ANDROID_CODEGEN_ASM         2   // hand-written asm, fallback generic
#define ANDROID_CODEGEN_GENERATED   3   // hand-written asm, fallback codegen

#ifdef NDEBUG
#   define ANDROID_RELEASE
#   define ANDROID_CODEGEN      ANDROID_CODEGEN_GENERATED
#else
#   define ANDROID_DEBUG
#   define ANDROID_CODEGEN      ANDROID_CODEGEN_GENERATED
#endif

#if defined(__arm__)
#   define ANDROID_ARM_CODEGEN  1
#else
#   define ANDROID_ARM_CODEGEN  0
#endif

#define DEBUG__CODEGEN_ONLY     0

/* Set to 1 to dump to the log the states that need a new
 * code-generated scanline callback, i.e. those that don't
 * have a corresponding shortcut function.
 */
#define DEBUG_NEEDS  0

#define ASSEMBLY_SCRATCH_SIZE   2048

// ----------------------------------------------------------------------------
namespace android {
// ----------------------------------------------------------------------------

static void init_y(context_t*, int32_t);
static void init_y_noop(context_t*, int32_t);
static void init_y_packed(context_t*, int32_t);
static void init_y_error(context_t*, int32_t);

static void step_y__generic(context_t* c);
static void step_y__nop(context_t*);
static void step_y__smooth(context_t* c);
static void step_y__tmu(context_t* c);
static void step_y__w(context_t* c);

static void scanline(context_t* c);
static void scanline_perspective(context_t* c);
static void scanline_perspective_single(context_t* c);
static void scanline_t32cb16blend(context_t* c);
static void scanline_t32cb16blend_dither(context_t* c);
static void scanline_t32cb16blend_srca(context_t* c);
static void scanline_t32cb16blend_clamp(context_t* c);
static void scanline_t32cb16blend_clamp_dither(context_t* c);
static void scanline_t32cb16blend_clamp_mod(context_t* c);
static void scanline_x32cb16blend_clamp_mod(context_t* c);
static void scanline_t32cb16blend_clamp_mod_dither(context_t* c);
static void scanline_x32cb16blend_clamp_mod_dither(context_t* c);
static void scanline_t32cb16(context_t* c);
static void scanline_t32cb16_dither(context_t* c);
static void scanline_t32cb16_clamp(context_t* c);
static void scanline_t32cb16_clamp_dither(context_t* c);
static void scanline_col32cb16blend(context_t* c);
static void scanline_t16cb16_clamp(context_t* c);
static void scanline_t16cb16blend_clamp_mod(context_t* c);
static void scanline_memcpy(context_t* c);
static void scanline_memset8(context_t* c);
static void scanline_memset16(context_t* c);
static void scanline_memset32(context_t* c);
static void scanline_noop(context_t* c);
static void scanline_set(context_t* c);
static void scanline_clear(context_t* c);

static void rect_generic(context_t* c, size_t yc);
static void rect_memcpy(context_t* c, size_t yc);

extern "C" void scanline_t32cb16blend_arm(uint16_t*, uint32_t*, size_t);
extern "C" void scanline_t32cb16_arm(uint16_t *dst, uint32_t *src, size_t ct);
extern "C" void scanline_col32cb16blend_neon(uint16_t *dst, uint32_t *col, size_t ct);
extern "C" void scanline_col32cb16blend_arm(uint16_t *dst, uint32_t col, size_t ct);

// ----------------------------------------------------------------------------

static inline uint16_t  convertAbgr8888ToRgb565(uint32_t  pix)
{
    return uint16_t( ((pix << 8) & 0xf800) |
                      ((pix >> 5) & 0x07e0) |
                      ((pix >> 19) & 0x001f) );
}

struct shortcut_t {
    needs_filter_t  filter;
    const char*     desc;
    void            (*scanline)(context_t*);
    void            (*init_y)(context_t*, int32_t);
};

...........................

}

What actually is ARM?

ARM (formerly Advanced RISC Machine and Acorn RISC Machine) is a reduced instruction set computer (RISC) instruction set architecture (ISA) developed by ARM Holdings. The ARM architecture is the most widely used 32-bit instruction set architecture in numbers produced.