Abrir whatsapp 6

Anuncio
--- 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 @@
# d efine TILE_SIZ E (TILE_WIDT H * TILE_H EIG H T)
/* g et frame tile coordinate. X X X: nothing to b e und erstood here, don't try. */
-static siz e_t tile_pos(siz e_t x, siz e_t y, siz e_t w, siz e_t h)
-{
+static siz e_t tile_pos(siz e_t x, siz e_t y, siz e_t w, siz e_t h) {
siz e_t flim = x + (y & ~1) * w;
if (y & 1) {
@ @ - 5 5,11 + 4 6,10 @ @
return flim;
}
-void q com_convert(const uint 8_t *src, picture_t *pic)
-{
- siz e_t width = pic - >format.i_width;
- siz e_t pitch = pic - > p[0].i_pitch;
- siz e_t height = pic - >format.i_height;
+void q com_convert(const uint 8_t *src, uint 8_t* dst, siz e_t w, siz e_t h) {
+ siz e_t width = w; //pic - >format.i_width;
+ siz e_t pitch = w; //pic - > p[0].i_pitch;
+ siz e_t height = h; //pic - >format.i_height;
const siz e_t tile_w = (width - 1) / TILE_WIDT H + 1;
const siz e_t tile_w_align = (tile_w + 1) & ~1;
@ @ -70,21 + 6 0,2 3 @ @
siz e_t luma_siz e = tile_w_align * tile_h_luma * TILE_SIZ E;
# d efine TILE_GRO UP_SIZ E (4 * TILE_SIZ E)
- if((luma_siz e % TILE_GRO UP_SIZ E) = 0)
+ if ((luma_siz e % TILE_GRO UP_SIZ E) = 0)
luma_siz e = (((luma_siz e - 1) / TILE_GRO UP_SIZ E) + 1) * TILE_GRO UP_SIZ E;
+
+
+
+
for(siz e_t y = 0; y < tile_h_luma; y+ +) {
for (siz e_t y = 0; y < tile_h_luma; y+ +) {
siz e_t row_width = width;
for(siz e_t x = 0; x < tile_w; x+ +) {
for (siz e_t x = 0; x < tile_w; x+ +) {
/* luma sourc e pointer for this tile */
const uint 8_t *src_luma = src
+ tile_pos(x, y,tile_w_align, tile_h_luma) * TILE_SIZ E;
const uint 8_t *src_luma = src
+ tile_pos(x, y, tile_w_align, tile_h_luma) * TILE_SIZ E;
+
+
+
+
/* 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;
}
Descargar