You are on page 1of 20

Table 1

--- qcom.h

+++ qcom.h

@@ -1,3 +1,14 @@

-#include <vlc_picture.h>

+#ifndef _QCOM_H_

+#define _QCOM_H_

-void qcom_convert(const uint8_t *src, picture_t *pic);

+#ifdef __cplusplus

+extern "C" {

+#endif

+void qcom_convert(const uint8_t *src, uint8_t* dst, size_t w, size_t h);

+#ifdef __cplusplus

+}

+#endif

+#endif

--- qcom.c

+++ qcom.c

@@ -20,18 +20,10 @@

* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.

*****************************************************************************/

-#ifdef HAVE_CONFIG_H

-# include "config.h"

-#endif

-#include <vlc_picture.h>

-#include <string.h>

#include <stdint.h>

+#include <string.h>

#include "qcom.h"

/*

* The format is called QOMX_COLOR_FormatYUV420PackedSemiPlanar64x32Tile2m8ka.

* First wtf: why call it YUV420? It is NV12 (interleaved U&V).

@@ -42,8 +34,7 @@

#define TILE_SIZE (TILE_WIDTH * TILE_HEIGHT)

-#include <vlc_picture.h>

-static size_t tile_pos(size_t x, size_t y, size_t w, size_t h)

-{

+static size_t tile_pos(size_t x, size_t y, size_t w, size_t h) {

size_t flim = x + (y & ~1) * w;

if (y & 1) {

@@ -55,11 +46,10 @@

return flim;

-void qcom_convert(const uint8_t *src, picture_t *pic)

-{

- size_t width = pic->format.i_width;

- size_t pitch = pic->p[0].i_pitch;

- size_t height = pic->format.i_height;

1
+void qcom_convert(const uint8_t *src, uint8_t* dst, size_t w, size_t h) {

+ size_t width = w; //pic->format.i_width;

+ size_t pitch = w; //pic->p[0].i_pitch;

+ size_t height = h; //pic->format.i_height;

const size_t tile_w = (width - 1) / TILE_WIDTH + 1;

const size_t tile_w_align = (tile_w + 1) & ~1;

@@ -70,21 +60,23 @@

size_t luma_size = tile_w_align * tile_h_luma * TILE_SIZE;

#define TILE_GROUP_SIZE (4 * TILE_SIZE)

- if((luma_size % TILE_GROUP_SIZE) != 0)

+ if ((luma_size % TILE_GROUP_SIZE) != 0)

luma_size = (((luma_size - 1) / TILE_GROUP_SIZE) + 1) * TILE_GROUP_SIZE;

+ for (size_t y = 0; y < tile_h_luma; y++) {

size_t row_width = width;

- for(size_t x = 0; x < tile_w; x++) {

+ for (size_t x = 0; x < tile_w; x++) {

/* luma source pointer for this tile */

- const uint8_t *src_luma = src

- + tile_pos(x, y,tile_w_align, tile_h_luma) * TILE_SIZE;

+ const uint8_t *src_luma = src

+ + tile_pos(x, y, tile_w_align, tile_h_luma) * TILE_SIZE;

/* chroma source pointer for this tile */

const uint8_t *src_chroma = src + luma_size

- + tile_pos(x, y/2, tile_w_align, tile_h_chroma) * TILE_SIZE;

+ + tile_pos(x, y / 2, tile_w_align, tile_h_chroma)

+ * TILE_SIZE;

if (y & 1)

- src_chroma += TILE_SIZE/2;

+ src_chroma += TILE_SIZE / 2;

/* account for right columns */

size_t tile_width = row_width;

@@ -101,19 +93,21 @@

/* dest chroma memory index for this tile */

/* XXX:
--- qcom.h
remove divisions */

- size_t
+++chroma_idx
qcom.h = (luma_idx / pitch) * pitch/2 + (luma_idx % pitch);

+ size_t
@@ chroma_idx
-1,3 +1,14 @@
= (luma_idx / pitch) * pitch / 2

+ -#include
+ (luma_idx
<vlc_picture.h>
% pitch) + w*h;

+#ifndef _QCOM_H_

tile_height /=
+#define
2; // we_QCOM_H_
copy 2 luma lines at once

while (tile_height--) {

- memcpy(&pic->p[0].p_pixels[luma_idx],
-void qcom_convert(const uint8_t *src, picture_t
src_luma,*pic);
tile_width);

+ +#ifdef __cplusplus

+ +extern
memcpy(&dst[luma_idx],
"C" { src_luma, tile_width);

src_luma
+#endif += TILE_WIDTH;

luma_idx
+ += pitch;

+void qcom_convert(const uint8_t *src, uint8_t* dst, size_t w, size_t h);

- memcpy(&pic->p[0].p_pixels[luma_idx],
+ src_luma, tile_width);

+ +#ifdef
memcpy(&dst[luma_idx],
__cplusplus src_luma, tile_width);

src_luma
+} += TILE_WIDTH;

luma_idx
+#endif += pitch;

- memcpy(&pic->p[1].p_pixels[chroma_idx],
+#endif src_chroma, tile_width);

+ ---
memcpy(&dst[chroma_idx],
qcom.c src_chroma, tile_width);

src_chroma
+++ qcom.c+= TILE_WIDTH;

2
chroma_idx
@@ -20,18 +20,10
+= pitch;
@@

} * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.

*****************************************************************************/

-#ifdef HAVE_CONFIG_H

-# include "config.h"

-#endif

-#include <vlc_picture.h>

-#include <string.h>

#include <stdint.h>

+#include <string.h>

#include "qcom.h"

/*

* The format is called QOMX_COLOR_FormatYUV420PackedSemiPlanar64x32Tile2m8ka.

* First wtf: why call it YUV420? It is NV12 (interleaved U&V).

@@ -42,8 +34,7 @@

#define TILE_SIZE (TILE_WIDTH * TILE_HEIGHT)

-#include <vlc_picture.h>

-static size_t tile_pos(size_t x, size_t y, size_t w, size_t h)

-{

+static size_t tile_pos(size_t x, size_t y, size_t w, size_t h) {

size_t flim = x + (y & ~1) * w;

if (y & 1) {

@@ -55,11 +46,10 @@

return flim;

-void qcom_convert(const uint8_t *src, picture_t *pic)

-{

- size_t width = pic->format.i_width;

- size_t pitch = pic->p[0].i_pitch;

- size_t height = pic->format.i_height;

+void qcom_convert(const uint8_t *src, uint8_t* dst, size_t w, size_t h) {

+ size_t width = w; //pic->format.i_width;

+ size_t pitch = w; //pic->p[0].i_pitch;

+ size_t height = h; //pic->format.i_height;

const size_t tile_w = (width - 1) / TILE_WIDTH + 1;

const size_t tile_w_align = (tile_w + 1) & ~1;

@@ -70,21 +60,23 @@

size_t luma_size = tile_w_align * tile_h_luma * TILE_SIZE;

#define TILE_GROUP_SIZE (4 * TILE_SIZE)

- if((luma_size % TILE_GROUP_SIZE) != 0)

+ if ((luma_size % TILE_GROUP_SIZE) != 0)

luma_size = (((luma_size - 1) / TILE_GROUP_SIZE) + 1) * TILE_GROUP_SIZE;

+ for (size_t y = 0; y < tile_h_luma; y++) {

size_t row_width = width;

- for(size_t x = 0; x < tile_w; x++) {

+ for (size_t x = 0; x < tile_w; x++) {

/* luma source pointer for this tile */

- const uint8_t *src_luma = src

- + tile_pos(x, y,tile_w_align, tile_h_luma) * TILE_SIZE;

3
+ const uint8_t *src_luma = src

+ + tile_pos(x, y, tile_w_align, tile_h_luma) * TILE_SIZE;

/* chroma source pointer for this tile */

const uint8_t *src_chroma = src + luma_size

- + tile_pos(x, y/2, tile_w_align, tile_h_chroma) * TILE_SIZE;

+ + tile_pos(x, y / 2, tile_w_align, tile_h_chroma)

+ * TILE_SIZE;

if (y & 1)

- src_chroma += TILE_SIZE/2;

+ src_chroma += TILE_SIZE / 2;

/* account for right columns */

size_t tile_width = row_width;

@@ -101,19 +93,21 @@

/* dest chroma memory index for this tile */

/* XXX: remove divisions */

- size_t chroma_idx = (luma_idx / pitch) * pitch/2 + (luma_idx % pitch);

+ size_t chroma_idx = (luma_idx / pitch) * pitch / 2

+ + (luma_idx % pitch) + w*h;

tile_height /= 2; // we copy 2 luma lines at once

while (tile_height--) {

- memcpy(&pic->p[0].p_pixels[luma_idx], src_luma, tile_width);

+ memcpy(&dst[luma_idx], src_luma, tile_width);

src_luma += TILE_WIDTH;

luma_idx += pitch;

- memcpy(&pic->p[0].p_pixels[luma_idx], src_luma, tile_width);

+ memcpy(&dst[luma_idx], src_luma, tile_width);

src_luma += TILE_WIDTH;

luma_idx += pitch;

- memcpy(&pic->p[1].p_pixels[chroma_idx], src_chroma, tile_width);

+ memcpy(&dst[chroma_idx], src_chroma, tile_width);

src_chroma += TILE_WIDTH;

chroma_idx += pitch;

4
--- qcom.h

+++ qcom.h

@@ -1,3 +1,14 @@

-#include <vlc_picture.h>

+#ifndef _QCOM_H_

+#define _QCOM_H_

-void qcom_convert(const uint8_t *src, picture_t *pic);

+#ifdef __cplusplus

+extern "C" {

+#endif

+void qcom_convert(const uint8_t *src, uint8_t* dst, size_t w, size_t h);

Table 1 +

+#ifdef __cplusplus

Table 1-2 +}

--- qcom.h +#endif

--- qcom.h +

+++ qcom.h +#endif

--- qcom.c

+++
@@ -1,3 +1,14 @@
qcom.h +++ qcom.c

@@ -20,18 +20,10 @@

-#include
@@ <vlc_picture.h>
-1,3 +1,14 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.

*****************************************************************************/

+#ifndef
-#include _QCOM_H_
<vlc_picture.h> -#ifdef HAVE_CONFIG_H

-# include "config.h"

+#ifndef _QCOM_H_ -#endif

-#include <vlc_picture.h>

+#define _QCOM_H_ -#include <string.h>

#include <stdint.h>

+#include <string.h>

+#define _QCOM_H_ #include "qcom.h"

-void qcom_convert(const uint8_t *src, picture_t *pic);

+#ifdef __cplusplus /*

* The format is called QOMX_COLOR_FormatYUV420PackedSemiPlanar64x32Tile2m8ka.

-void qcom_convert(const
+extern "C" { uint8_t *src, picture_t *pic); * First wtf: why call it YUV420? It is NV12 (interleaved U&V).

@@ -42,8 +34,7 @@

+#ifdef
+#endif__cplusplus #define TILE_SIZE (TILE_WIDTH * TILE_HEIGHT)

/* get frame tile coordinate. XXX: nothing to be understood here, don't try. */

+
+extern "C" { -static size_t tile_pos(size_t x, size_t y, size_t w, size_t h)

-{

+void
+#endifqcom_convert(const uint8_t *src, uint8_t* dst, size_t w, size_t h); +static size_t tile_pos(size_t x, size_t y, size_t w, size_t h) {

size_t flim = x + (y & ~1) * w;

+ First

wtf: why call it YUV420?
+ if (y & 1) {

Table 1-1
+#ifdef __cplusplus @@ -55,11 +46,10 @@

+void qcom_convert(const uint8_t *src, uint8_t* dst, size_t w, size_t h); return flim;

-#include
+} <vlc_picture.h> }

+
+#endif
+#ifdef __cplusplus
+
+}
+#endif
+#endif
--- qcom.c
+
+++ qcom.c

@@ -20,18 +20,10 @@
+#endif 02:16
* Inc.,
--- 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
qcom.c
*****************************************************************************/
+++ qcom.c

@@ -20,18 +20,10 @@ 02:16


-#ifdef HAVE_CONFIG_H
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
-# include "config.h"
*****************************************************************************/
-#endif

-#include
-#ifdef <vlc_picture.h>
HAVE_CONFIG_H

- include "config.h"
-#
-#include <string.h>
-#endif
#include <stdint.h>
-
-
-#include <vlc_picture.h>
+#include <string.h>
-
#include "qcom.h"
-#include <string.h>

-#include <stdint.h>
-/*

* The format
+#include is called QOMX_COLOR_FormatYUV420PackedSemiPlanar64x32Tile2m8ka.
<string.h>

*#include
First wtf:"qcom.h"
why call it YUV420? It is NV12 (interleaved U&V).

@@ -42,8 +34,7 @@

#define TILE_SIZE (TILE_WIDTH * TILE_HEIGHT)


-

/*
-#include <vlc_picture.h>
* The format is called QOMX_COLOR_FormatYUV420PackedSemiPlanar64x32Tile2m8ka.
-static size_t tile_pos(size_t x, size_t y, size_t w, size_t h)
* First wtf: why call it YUV420? It is NV12 (interleaved U&V).
-{
@@ -42,8
+static +34,7
size_t @@
tile_pos(size_t x, size_t y, size_t w, size_t h) {
#define
size_t flim = x + (y & (TILE_WIDTH
TILE_SIZE ~1) * w; * TILE_HEIGHT)

if (y & 1) {<vlc_picture.h>
-#include
@@
-static-55,11
size_t +46,10 @@ x, size_t y, size_t w, size_t h)
tile_pos(size_t
return flim;
-{
}
+static size_t tile_pos(size_t x, size_t y, size_t w, size_t h) {

size_t flim = x + (y & ~1) * w;


-void qcom_convert(const uint8_t *src, picture_t *pic)

Text
-{
if & 1) {width = pic->format.i_width;
- (ysize_t
@@
- size_t +46,10
-55,11pitch @@
= pic->p[0].i_pitch;

- size_t
return height
flim; = pic->format.i_height;
+void
} qcom_convert(const uint8_t *src, uint8_t* dst, size_t w, size_t h) {

+ size_t width = w; //pic->format.i_width;

+ size_t pitch = w; //pic->p[0].i_pitch;


-void qcom_convert(const uint8_t *src, picture_t *pic)
+ size_t height = h; //pic->format.i_height;
-{

- size_t width = pic->format.i_width;


const size_t tile_w = (width - 1) / TILE_WIDTH + 1;
-const
size_t pitch = pic->p[0].i_pitch;
size_t tile_w_align = (tile_w + 1) & ~1;
-@@ size_t
-70,21height = pic->format.i_height;
+60,23 @@
+void
size_t luma_size = tile_w_align
qcom_convert(const * tile_h_luma
uint8_t *src, size_t w, size_t h) {
uint8_t* dst,* TILE_SIZE;

+ size_t width = w; //pic->format.i_width;


#define
+ size_tTILE_GROUP_SIZE (4 * TILE_SIZE)
pitch = w; //pic->p[0].i_pitch;
- if((luma_size % TILE_GROUP_SIZE) != 0)
+ size_t height = h; //pic->format.i_height;
+ if ((luma_size % TILE_GROUP_SIZE) != 0)

luma_size = (((luma_size - 1) / TILE_GROUP_SIZE) + 1) * TILE_GROUP_SIZE;


const size_t tile_w = (width - 1) / TILE_WIDTH + 1;

const size_t tile_w_align = (tile_w + 1) & ~1;

@@ -70,21 +60,23 @@
+ for (size_t y = 0; y < tile_h_luma; y++) {
size_t luma_size
size_t = tile_w_align
row_width = width; * tile_h_luma * TILE_SIZE;

- for(size_t x = 0; x < tile_w; x++) {

+
#definefor (size_t x = 0; x < tile_w;
TILE_GROUP_SIZE x++) {
(4 * TILE_SIZE)

- /* luma source
if((luma_size pointer for this tile!=*/0)
% TILE_GROUP_SIZE)
- const uint8_t *src_luma = src
+ if ((luma_size % TILE_GROUP_SIZE) != 0)
- + tile_pos(x, y,tile_w_align, tile_h_luma) * TILE_SIZE;
luma_size = (((luma_size - 1) / TILE_GROUP_SIZE) + 1) * TILE_GROUP_SIZE;
+ const uint8_t *src_luma = src

+ + tile_pos(x, y, tile_w_align, tile_h_luma) * TILE_SIZE;

+ for (size_t y = 0;
/* chroma y < tile_h_luma;
source pointer for y++) { */
this tile

const uint8_t = width;


*src_chroma
size_t row_width = src + luma_size

-- + tile_pos(x,
for(size_t x = 0; x y/2, tile_w_align,
< tile_w; x++) { tile_h_chroma) * TILE_SIZE;

+
+ + tile_pos(x,
for (size_t x = 0; x <ytile_w;
/ 2, tile_w_align,
x++) { tile_h_chroma)

+ * TILE_SIZE;
/* luma source pointer for this tile */
+
- const uint8_t *src_luma = src
if (y & 1)
- + tile_pos(x, y,tile_w_align, tile_h_luma) * TILE_SIZE;
- src_chroma += TILE_SIZE/2;
+ const uint8_t *src_luma = src
+ src_chroma += TILE_SIZE / 2;
+ + tile_pos(x, y, tile_w_align, tile_h_luma) * TILE_SIZE;

/* account for right columns */

size_t tile_width
/* chroma source= pointer
row_width;
for this tile */

@@ -101,19
const uint8_t +93,21 @@ = src + luma_size
*src_chroma

- + tile_pos(x, y/2, tile_w_align, tile_h_chroma) * TILE_SIZE;


/* dest chroma memoryy / 2,index for this tile_h_chroma)
tile */
+ + tile_pos(x, tile_w_align,
/* XXX:
--- qcom.h
remove divisions */
+ * TILE_SIZE;
- size_t
+++chroma_idx
qcom.h = (luma_idx / pitch) * pitch/2 + (luma_idx % pitch);
+
+ size_t
@@ chroma_idx
-1,3 +1,14 @@
= (luma_idx / pitch) * pitch / 2
if (y & 1)
+ -#include
+ (luma_idx
<vlc_picture.h>
% pitch) + w*h;
- src_chroma += TILE_SIZE/2;
+#ifndef _QCOM_H_
+
tile_height /= src_chroma
+#define += 2TILE_SIZE
2; // we_QCOM_H_
copy luma lines /at2;once

while (tile_height--) {

- /*memcpy(&pic->p[0].p_pixels[luma_idx],
-void qcom_convert(const
account for right columns */ uint8_t *src, picture_t
src_luma,*pic);
tile_width);

+ +#ifdef
size_t __cplusplus
tile_width = row_width;
+ +extern
memcpy(&dst[luma_idx],
"C" { src_luma, tile_width);
@@ -101,19 +93,21 @@
src_luma
+#endif += TILE_WIDTH;

luma_idx
+ += pitch;
/* dest chroma memory index for this tile */
+void qcom_convert(const uint8_t *src, uint8_t* dst, size_t w, size_t h);
/* ---
XXX:
qcom.h
remove divisions */
- memcpy(&pic->p[0].p_pixels[luma_idx],
+ src_luma, tile_width);
-+ +++
size_t chroma_idx
qcom.h = (luma_idx pitch/2 + (luma_idx % pitch);
/ pitch) *tile_width);
+#ifdef
memcpy(&dst[luma_idx],
__cplusplus src_luma,
+ @@
size_t -1,3 +1,14
+} chroma_idx
src_luma @@
= (luma_idx / pitch) * pitch / 2
+= TILE_WIDTH;

+ luma_idx
+#endif += pitch;% pitch) + w*h;
+ (luma_idx
-#include <vlc_picture.h>

+
+#ifndef _QCOM_H_
-tile_height /=
memcpy(&pic->p[1].p_pixels[chroma_idx],
+#endif
+#define
2; // we _QCOM_H_
copy 2 luma lines at once src_chroma, tile_width);

+ ---
memcpy(&dst[chroma_idx],
qcom.c src_chroma, tile_width);
while (tile_height--) {
src_chroma
+++ qcom.c+= TILE_WIDTH;
- -void
memcpy(&pic->p[0].p_pixels[luma_idx],
qcom_convert(const uint8_t *src, picture_t src_luma,
*pic);tile_width);
chroma_idx
@@ -20,18 +20,10
+= pitch;@@
+ +#ifdef __cplusplus
} * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ +extern "C" {
memcpy(&dst[luma_idx], src_luma, tile_width);
*****************************************************************************/
+#endif
src_luma += TILE_WIDTH;

+ luma_idx
-#ifdef += pitch;
HAVE_CONFIG_H

-# include
+void "config.h"
qcom_convert(const uint8_t *src, uint8_t* dst, size_t w, size_t h);

- -#endif
+ memcpy(&pic->p[0].p_pixels[luma_idx], src_luma, tile_width);
-+#ifdef
+ memcpy(&dst[luma_idx],
__cplusplus src_luma, tile_width);
-#include <vlc_picture.h>
+}src_luma += TILE_WIDTH;
-
+#endif
luma_idx += pitch;
-#include <string.h>
+
#include <stdint.h>
- memcpy(&pic->p[1].p_pixels[chroma_idx], src_chroma, tile_width);
-

1
+ +#include <string.h>
memcpy(&dst[chroma_idx], src_chroma, tile_width);

#include "qcom.h"
src_chroma += TILE_WIDTH;

chroma_idx += pitch;
-
}
/*
*****************************************************************************/
* The format is called QOMX_COLOR_FormatYUV420PackedSemiPlanar64x32Tile2m8ka.

* First wtf: why call it YUV420? It is NV12 (interleaved U&V).


-#ifdef HAVE_CONFIG_H
@@ -42,8 +34,7 @@
-# includeTILE_SIZE
#define "config.h" (TILE_WIDTH * TILE_HEIGHT)

-#endif

--#include <vlc_picture.h>

-static size_t
-#include tile_pos(size_t x, size_t y, size_t w, size_t h)
<vlc_picture.h>
-{
-
+static size_t tile_pos(size_t x, size_t y, size_t w, size_t h) {
-#include <string.h>
size_t flim = x + (y & ~1) * w;
#include <stdint.h>

-
if (y & 1) {
+#include <string.h>
@@ -55,11 +46,10 @@
#include
return "qcom.h"
flim;

-void
/* qcom_convert(const uint8_t *src, picture_t *pic)

-{
* The format is called QOMX_COLOR_FormatYUV420PackedSemiPlanar64x32Tile2m8ka.
- size_t width = pic->format.i_width;
* First wtf: why call it YUV420? It is NV12 (interleaved U&V).
- size_t pitch = pic->p[0].i_pitch;
@@ -42,8 +34,7 @@
- size_t height = pic->format.i_height;
#define TILE_SIZE (TILE_WIDTH * TILE_HEIGHT)
+void qcom_convert(const uint8_t *src, uint8_t* dst, size_t w, size_t h) {

+ size_t width = w; //pic->format.i_width;

+ size_t<vlc_picture.h>
-#include pitch = w; //pic->p[0].i_pitch;

+ size_t
-static size_theight = h; //pic->format.i_height;
tile_pos(size_t x, size_t y, size_t w, size_t h)

-{
const
+static size_t tile_w = (widthx, -size_t
size_t tile_pos(size_t 1) / TILE_WIDTH + 1; h) {
y, size_t w, size_t
const size_t
size_t flim = xtile_w_align
+ (y & ~1) *=w;(tile_w + 1) & ~1;
@@ -70,21 +60,23 @@

size_t luma_size = tile_w_align * tile_h_luma * TILE_SIZE;


if (y & 1) {

@@ -55,11 +46,10 @@
#define TILE_GROUP_SIZE (4 * TILE_SIZE)
return flim; % TILE_GROUP_SIZE) != 0)
- if((luma_size

+} if ((luma_size % TILE_GROUP_SIZE) != 0)

luma_size = (((luma_size - 1) / TILE_GROUP_SIZE) + 1) * TILE_GROUP_SIZE;

-void qcom_convert(const uint8_t *src, picture_t *pic)

-{
+ for (size_t
widthy== pic->format.i_width;
0; y < tile_h_luma; y++) {
- size_t
size_t row_width = width;
- size_t pitch = pic->p[0].i_pitch;
- for(size_t x = 0; x < tile_w; x++) {
- size_t height = pic->format.i_height;
+ for (size_t x = 0; x < tile_w; x++) {
+void qcom_convert(const uint8_t *src, uint8_t* dst, size_t w, size_t h) {
/* luma source pointer for this tile */
+ = w; //pic->format.i_width;
- size_tconstwidthuint8_t *src_luma = src
+
- size_t pitch = w; //pic->p[0].i_pitch;
+ tile_pos(x, y,tile_w_align, tile_h_luma) * TILE_SIZE;

+ size_tconst
heightuint8_t *src_luma = src
= h; //pic->format.i_height;

+ + tile_pos(x, y, tile_w_align, tile_h_luma) * TILE_SIZE;

const size_t tile_w = (width - 1) / TILE_WIDTH + 1;


/* chroma source pointer for this tile */
const size_t tile_w_align = (tile_w + 1) & ~1;
const uint8_t *src_chroma = src + luma_size
@@ -70,21 +60,23 @@
- + tile_pos(x, y/2, tile_w_align, tile_h_chroma) * TILE_SIZE;
size_t luma_size = tile_w_align * tile_h_luma * TILE_SIZE;
+ + tile_pos(x, y / 2, tile_w_align, tile_h_chroma)

+ * TILE_SIZE;
#define TILE_GROUP_SIZE (4 * TILE_SIZE)
+
-if (y if((luma_size
& 1) % TILE_GROUP_SIZE) != 0)

-
+ src_chroma
if ((luma_size += TILE_SIZE/2; != 0)
% TILE_GROUP_SIZE)

+
luma_size = src_chroma
(((luma_size +=
- 1) TILE_SIZE / 2;
/ TILE_GROUP_SIZE) + 1) * TILE_GROUP_SIZE;

/* account for right columns */

size_t tile_width = row_width;


+ for (size_t y = 0; y < tile_h_luma; y++) {
@@ -101,19 +93,21 @@
size_t row_width = width;

- for(size_t x = 0; x < tile_w; x++) {


/* dest chroma memory index for this tile */
+ for x = 0; xdivisions
(size_tremove
/* XXX: < tile_w;*/x++) {

- size_t chroma_idx
/* luma = (luma_idx
source pointer / pitch)
for this tile */ * pitch/2 + (luma_idx % pitch);

-+ size_t chroma_idx
const uint8_t = (luma_idx
*src_luma = src / pitch) * pitch / 2

-+ ++tile_pos(x,
(luma_idxy,tile_w_align,
% pitch) + w*h;
tile_h_luma) * TILE_SIZE;

+ const uint8_t *src_luma = src


tile_height /= 2; // we copy 2 luma lines at once
+ + tile_pos(x, y, tile_w_align, tile_h_luma) * TILE_SIZE;
while (tile_height--) {

- memcpy(&pic->p[0].p_pixels[luma_idx], src_luma, tile_width);


/* chroma source pointer for this tile */
+
const uint8_t *src_chroma = src + luma_size
+ memcpy(&dst[luma_idx], src_luma, tile_width);
- + tile_pos(x,
src_luma y/2, tile_w_align, tile_h_chroma) * TILE_SIZE;
+= TILE_WIDTH;
+ + tile_pos(x,
luma_idx += pitch;y / 2, tile_w_align, tile_h_chroma)

+ * TILE_SIZE;
-+ memcpy(&pic->p[0].p_pixels[luma_idx], src_luma, tile_width);

+ memcpy(&dst[luma_idx], src_luma, tile_width);


if (y & 1)
src_luma += TILE_WIDTH;
- src_chroma += TILE_SIZE/2;
luma_idx += pitch;
+ src_chroma += TILE_SIZE / 2;

- memcpy(&pic->p[1].p_pixels[chroma_idx], src_chroma, tile_width);


/* account for right columns */
+ memcpy(&dst[chroma_idx], src_chroma, tile_width);
size_t +==TILE_WIDTH;
tile_width
src_chroma row_width;

@@ -101,19chroma_idx
+93,21 @@ += pitch;

/* dest chroma memory index for this tile */

/* XXX: remove divisions */

- size_t chroma_idx = (luma_idx / pitch) * pitch/2 + (luma_idx % pitch);

+ size_t chroma_idx = (luma_idx / pitch) * pitch / 2

+ + (luma_idx % pitch) + w*h;

tile_height /= 2; // we copy 2 luma lines at once

while (tile_height--) {

- memcpy(&pic->p[0].p_pixels[luma_idx], src_luma, tile_width);

+ memcpy(&dst[luma_idx], src_luma, tile_width);

src_luma += TILE_WIDTH;

luma_idx += pitch;

- memcpy(&pic->p[0].p_pixels[luma_idx], src_luma, tile_width);

+ memcpy(&dst[luma_idx], src_luma, tile_width);

src_luma += TILE_WIDTH;

luma_idx += pitch;

- memcpy(&pic->p[1].p_pixels[chroma_idx], src_chroma, tile_width);

+ memcpy(&dst[chroma_idx], src_chroma, tile_width);

src_chroma += TILE_WIDTH;

chroma_idx += pitch;

2
m.h

om.h

+1,14 @@

e <vlc_picture.h>

_QCOM_H_

e _QCOM_H_

com_convert(const uint8_t *src, picture_t *pic);

__cplusplus

"C" {

com_convert(const uint8_t *src, uint8_t* dst, size_t w, size_t h);

__cplusplus

m.c

om.c

18 +20,10 @@

51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.

*********************************************************************/

HAVE_CONFIG_H

de "config.h"

e <vlc_picture.h>

e <string.h>

e <stdint.h>

de <string.h>

e "qcom.h"

ormat is called QOMX_COLOR_FormatYUV420PackedSemiPlanar64x32Tile2m8ka.

wtf: why call it YUV420? It is NV12 (interleaved U&V).

8 +34,7 @@

TILE_SIZE (TILE_WIDTH * TILE_HEIGHT)

ame tile coordinate. XXX: nothing to be understood here, don't try. */

ize_t tile_pos(size_t x, size_t y, size_t w, size_t h)

size_t tile_pos(size_t x, size_t y, size_t w, size_t h) {

t flim = x + (y & ~1) * w;

& 1) {

11 +46,10 @@

n flim;

3
4
5
6
7
8
9
Text

10
11
12
13
14
Table 1

1
16 Apr 2018

16 Mar 2018

03:33

You might also like