FFmpeg
Loading...
Searching...
No Matches
g2meet.c File Reference

Go2Webinar / Go2Meeting decoder. More...

#include <inttypes.h>
#include <zlib.h>
#include "libavutil/attributes.h"
#include "libavutil/imgutils.h"
#include "libavutil/mem.h"
#include "libavutil/mem_internal.h"
#include "avcodec.h"
#include "blockdsp.h"
#include "bytestream.h"
#include "codec_internal.h"
#include "decode.h"
#include "elsdec.h"
#include "get_bits.h"
#include "idctdsp.h"
#include "jpegtables.h"
#include "mjpegdec.h"

Go to the source code of this file.

Data Structures

struct  ePICPixListElem
 
struct  ePICPixHashElem
 
struct  ePICPixHash
 
struct  ePICContext
 
struct  JPGContext
 
struct  G2MContext
 

Macros

#define EPIC_PIX_STACK_SIZE   1024
 
#define EPIC_PIX_STACK_MAX   (EPIC_PIX_STACK_SIZE - 1)
 
#define EPIC_HASH_SIZE   256
 
#define LOAD_NEIGHBOURS(x)
 
#define UPDATE_NEIGHBOURS(x)
 
#define R_shift   16
 
#define G_shift   8
 
#define B_shift   0
 
#define TOSIGNED(val)
 
#define APPLY_ALPHA(src, new, alpha)
 

Enumerations

enum  ChunkType {
  DISPLAY_INFO = 0xC8 , TILE_DATA , CURSOR_POS , CURSOR_SHAPE ,
  CHUNK_CC , CHUNK_CD
}
 
enum  Compression { COMPR_EPIC_J_B = 2 , COMPR_KEMPF_J_B }
 

Functions

static av_cold int jpg_init (AVCodecContext *avctx, JPGContext *c)
 
static av_cold void jpg_free_context (JPGContext *ctx)
 
static void jpg_unescape (const uint8_t *src, int src_size, uint8_t *dst, int *dst_size)
 
static int jpg_decode_block (JPGContext *c, GetBitContext *gb, int plane, int16_t *block)
 
static void yuv2rgb (uint8_t *out, int ridx, int Y, int U, int V)
 
static int jpg_decode_data (JPGContext *c, int width, int height, const uint8_t *src, int src_size, uint8_t *dst, int dst_stride, const uint8_t *mask, int mask_stride, int num_mbs, int swapuv)
 
static int djb2_hash (uint32_t key)
 
static void epic_hash_init (ePICPixHash *hash)
 
static ePICPixHashElemepic_hash_find (const ePICPixHash *hash, uint32_t key)
 
static ePICPixHashElemepic_hash_add (ePICPixHash *hash, uint32_t key)
 
static int epic_add_pixel_to_cache (ePICPixHash *hash, uint32_t key, uint32_t pix)
 
static int epic_cache_entries_for_pixel (const ePICPixHash *hash, uint32_t pix)
 
static void epic_free_pixel_cache (ePICPixHash *hash)
 
static int is_pixel_on_stack (const ePICContext *dc, uint32_t pix)
 
static int epic_decode_component_pred (ePICContext *dc, int N, int W, int NW)
 
static uint32_t epic_decode_pixel_pred (ePICContext *dc, int x, int y, const uint32_t *curr_row, const uint32_t *above_row)
 
static int epic_predict_pixel (ePICContext *dc, uint8_t *rung, uint32_t *pPix, uint32_t pix)
 
static int epic_handle_edges (ePICContext *dc, int x, int y, const uint32_t *curr_row, const uint32_t *above_row, uint32_t *pPix)
 
static int epic_decode_run_length (ePICContext *dc, int x, int y, int tile_width, const uint32_t *curr_row, const uint32_t *above_row, const uint32_t *above2_row, uint32_t *pPix, int *pRun)
 
static int epic_predict_pixel2 (ePICContext *dc, uint8_t *rung, uint32_t *pPix, uint32_t pix)
 
static int epic_predict_from_NW_NE (ePICContext *dc, int x, int y, int run, int tile_width, const uint32_t *curr_row, const uint32_t *above_row, uint32_t *pPix)
 
static int epic_decode_from_cache (ePICContext *dc, uint32_t W, uint32_t *pPix)
 
static int epic_decode_tile (ePICContext *dc, uint8_t *out, int tile_height, int tile_width, int stride)
 
static int epic_jb_decode_tile (G2MContext *c, int tile_x, int tile_y, const uint8_t *src, size_t src_size, AVCodecContext *avctx)
 
static int kempf_restore_buf (const uint8_t *src, int len, uint8_t *dst, int stride, const uint8_t *jpeg_tile, int tile_stride, int width, int height, const uint8_t *pal, int npal, int tidx)
 
static int kempf_decode_tile (G2MContext *c, int tile_x, int tile_y, const uint8_t *src, int src_size)
 
static int g2m_init_buffers (G2MContext *c)
 
static int g2m_load_cursor (AVCodecContext *avctx, G2MContext *c, GetByteContext *gb)
 
static void g2m_paint_cursor (G2MContext *c, uint8_t *dst, int stride)
 
static int g2m_decode_frame (AVCodecContext *avctx, AVFrame *pic, int *got_picture_ptr, AVPacket *avpkt)
 
static av_cold int g2m_decode_init (AVCodecContext *avctx)
 
static av_cold int g2m_decode_end (AVCodecContext *avctx)
 

Variables

static const uint8_t luma_quant [64]
 
static const uint8_t chroma_quant [64]
 
const FFCodec ff_g2m_decoder
 

Detailed Description

Go2Webinar / Go2Meeting decoder.

Definition in file g2meet.c.

Macro Definition Documentation

◆ EPIC_PIX_STACK_SIZE

#define EPIC_PIX_STACK_SIZE   1024

Definition at line 47 of file g2meet.c.

Referenced by is_pixel_on_stack().

◆ EPIC_PIX_STACK_MAX

#define EPIC_PIX_STACK_MAX   (EPIC_PIX_STACK_SIZE - 1)

◆ EPIC_HASH_SIZE

#define EPIC_HASH_SIZE   256

Definition at line 98 of file g2meet.c.

Referenced by djb2_hash(), and epic_free_pixel_cache().

◆ LOAD_NEIGHBOURS

#define LOAD_NEIGHBOURS ( x)
Value:
W = curr_row[(x) - 1]; \
N = above_row[(x)]; \
WW = curr_row[(x) - 2]; \
NW = above_row[(x) - 1]; \
NE = above_row[(x) + 1]; \
NN = above2_row[(x)]; \
NNW = above2_row[(x) - 1]; \
NWW = above_row[(x) - 2]; \
NNE = above2_row[(x) + 1]
#define N
Definition af_mcompand.c:54
#define W(a, i, v)
Definition jpegls.h:119
#define NN(type, name)
Definition vf_shear.c:115

Definition at line 354 of file g2meet.c.

Referenced by epic_decode_run_length().

◆ UPDATE_NEIGHBOURS

#define UPDATE_NEIGHBOURS ( x)
Value:
NNW = NN; \
NN = NNE; \
NWW = NW; \
NW = N; \
N = NE; \
NE = above_row[(x) + 1]; \
NNE = above2_row[(x) + 1]

Definition at line 365 of file g2meet.c.

Referenced by epic_decode_run_length().

◆ R_shift

#define R_shift   16

Definition at line 374 of file g2meet.c.

Referenced by epic_decode_pixel_pred(), epic_handle_edges(), and epic_jb_decode_tile().

◆ G_shift

#define G_shift   8

Definition at line 375 of file g2meet.c.

Referenced by epic_decode_pixel_pred(), epic_handle_edges(), and epic_jb_decode_tile().

◆ B_shift

#define B_shift   0

Definition at line 376 of file g2meet.c.

Referenced by epic_decode_pixel_pred(), epic_handle_edges(), and epic_jb_decode_tile().

◆ TOSIGNED

#define TOSIGNED ( val)
Value:
(((val) >> 1) ^ -((val) & 1))
static double val(void *priv, double ch)
Definition aeval.c:77

Definition at line 494 of file g2meet.c.

Referenced by epic_decode_component_pred(), and epic_decode_pixel_pred().

◆ APPLY_ALPHA

#define APPLY_ALPHA ( src,
new,
alpha )
Value:
src = (src * (256 - alpha) + new * alpha) >> 8
static const int16_t alpha[]
Definition ilbcdata.h:55
#define src
Definition vp8dsp.c:248

Definition at line 1323 of file g2meet.c.

Referenced by g2m_paint_cursor().

Enumeration Type Documentation

◆ ChunkType

enum ChunkType
Enumerator
DISPLAY_INFO 
TILE_DATA 
CURSOR_POS 
CURSOR_SHAPE 
CHUNK_CC 
CHUNK_CD 

Definition at line 50 of file g2meet.c.

◆ Compression

Enumerator
COMPR_EPIC_J_B 
COMPR_KEMPF_J_B 

Definition at line 59 of file g2meet.c.

Function Documentation

◆ jpg_init()

static av_cold int jpg_init ( AVCodecContext * avctx,
JPGContext * c )
static

Definition at line 166 of file g2meet.c.

Referenced by g2m_decode_init().

◆ jpg_free_context()

static av_cold void jpg_free_context ( JPGContext * ctx)
static

Definition at line 195 of file g2meet.c.

Referenced by g2m_decode_end().

◆ jpg_unescape()

static void jpg_unescape ( const uint8_t * src,
int src_size,
uint8_t * dst,
int * dst_size )
static

Definition at line 207 of file g2meet.c.

Referenced by jpg_decode_data().

◆ jpg_decode_block()

static int jpg_decode_block ( JPGContext * c,
GetBitContext * gb,
int plane,
int16_t * block )
static

Definition at line 224 of file g2meet.c.

Referenced by jpg_decode_data().

◆ yuv2rgb()

static void yuv2rgb ( uint8_t * out,
int ridx,
int Y,
int U,
int V )
inlinestatic

Definition at line 264 of file g2meet.c.

Referenced by create_filtergraph(), jpg_decode_data(), tonemap_opencl_init(), and yuv2rgb().

◆ jpg_decode_data()

static int jpg_decode_data ( JPGContext * c,
int width,
int height,
const uint8_t * src,
int src_size,
uint8_t * dst,
int dst_stride,
const uint8_t * mask,
int mask_stride,
int num_mbs,
int swapuv )
static

Definition at line 271 of file g2meet.c.

Referenced by epic_jb_decode_tile(), and kempf_decode_tile().

◆ djb2_hash()

static int djb2_hash ( uint32_t key)
static

Definition at line 379 of file g2meet.c.

Referenced by epic_hash_add(), and epic_hash_find().

◆ epic_hash_init()

static void epic_hash_init ( ePICPixHash * hash)
static

Definition at line 391 of file g2meet.c.

Referenced by epic_jb_decode_tile().

◆ epic_hash_find()

static ePICPixHashElem * epic_hash_find ( const ePICPixHash * hash,
uint32_t key )
static

◆ epic_hash_add()

static ePICPixHashElem * epic_hash_add ( ePICPixHash * hash,
uint32_t key )
static

Definition at line 408 of file g2meet.c.

Referenced by epic_add_pixel_to_cache().

◆ epic_add_pixel_to_cache()

static int epic_add_pixel_to_cache ( ePICPixHash * hash,
uint32_t key,
uint32_t pix )
static

Definition at line 431 of file g2meet.c.

Referenced by epic_decode_tile().

◆ epic_cache_entries_for_pixel()

static int epic_cache_entries_for_pixel ( const ePICPixHash * hash,
uint32_t pix )
inlinestatic

Definition at line 452 of file g2meet.c.

Referenced by epic_decode_tile().

◆ epic_free_pixel_cache()

static void epic_free_pixel_cache ( ePICPixHash * hash)
static

Definition at line 463 of file g2meet.c.

Referenced by epic_jb_decode_tile().

◆ is_pixel_on_stack()

static int is_pixel_on_stack ( const ePICContext * dc,
uint32_t pix )
inlinestatic

◆ epic_decode_component_pred()

static int epic_decode_component_pred ( ePICContext * dc,
int N,
int W,
int NW )
inlinestatic

Definition at line 496 of file g2meet.c.

Referenced by epic_decode_pixel_pred().

◆ epic_decode_pixel_pred()

static uint32_t epic_decode_pixel_pred ( ePICContext * dc,
int x,
int y,
const uint32_t * curr_row,
const uint32_t * above_row )
static

Definition at line 503 of file g2meet.c.

Referenced by epic_decode_tile().

◆ epic_predict_pixel()

static int epic_predict_pixel ( ePICContext * dc,
uint8_t * rung,
uint32_t * pPix,
uint32_t pix )
static

Definition at line 555 of file g2meet.c.

Referenced by epic_handle_edges().

◆ epic_handle_edges()

static int epic_handle_edges ( ePICContext * dc,
int x,
int y,
const uint32_t * curr_row,
const uint32_t * above_row,
uint32_t * pPix )
static

Definition at line 566 of file g2meet.c.

Referenced by epic_decode_tile().

◆ epic_decode_run_length()

static int epic_decode_run_length ( ePICContext * dc,
int x,
int y,
int tile_width,
const uint32_t * curr_row,
const uint32_t * above_row,
const uint32_t * above2_row,
uint32_t * pPix,
int * pRun )
static

Definition at line 597 of file g2meet.c.

Referenced by epic_decode_tile().

◆ epic_predict_pixel2()

static int epic_predict_pixel2 ( ePICContext * dc,
uint8_t * rung,
uint32_t * pPix,
uint32_t pix )
static

Definition at line 732 of file g2meet.c.

Referenced by epic_predict_from_NW_NE().

◆ epic_predict_from_NW_NE()

static int epic_predict_from_NW_NE ( ePICContext * dc,
int x,
int y,
int run,
int tile_width,
const uint32_t * curr_row,
const uint32_t * above_row,
uint32_t * pPix )
static

Definition at line 743 of file g2meet.c.

Referenced by epic_decode_tile().

◆ epic_decode_from_cache()

static int epic_decode_from_cache ( ePICContext * dc,
uint32_t W,
uint32_t * pPix )
static

Definition at line 771 of file g2meet.c.

Referenced by epic_decode_tile().

◆ epic_decode_tile()

static int epic_decode_tile ( ePICContext * dc,
uint8_t * out,
int tile_height,
int tile_width,
int stride )
static

Definition at line 800 of file g2meet.c.

Referenced by epic_jb_decode_tile().

◆ epic_jb_decode_tile()

static int epic_jb_decode_tile ( G2MContext * c,
int tile_x,
int tile_y,
const uint8_t * src,
size_t src_size,
AVCodecContext * avctx )
static

Definition at line 866 of file g2meet.c.

Referenced by g2m_decode_frame().

◆ kempf_restore_buf()

static int kempf_restore_buf ( const uint8_t * src,
int len,
uint8_t * dst,
int stride,
const uint8_t * jpeg_tile,
int tile_stride,
int width,
int height,
const uint8_t * pal,
int npal,
int tidx )
static

Definition at line 1017 of file g2meet.c.

Referenced by kempf_decode_tile().

◆ kempf_decode_tile()

static int kempf_decode_tile ( G2MContext * c,
int tile_x,
int tile_y,
const uint8_t * src,
int src_size )
static

Definition at line 1052 of file g2meet.c.

Referenced by g2m_decode_frame().

◆ g2m_init_buffers()

static int g2m_init_buffers ( G2MContext * c)
static

Definition at line 1161 of file g2meet.c.

Referenced by g2m_decode_frame().

◆ g2m_load_cursor()

static int g2m_load_cursor ( AVCodecContext * avctx,
G2MContext * c,
GetByteContext * gb )
static

Definition at line 1204 of file g2meet.c.

Referenced by g2m_decode_frame().

◆ g2m_paint_cursor()

static void g2m_paint_cursor ( G2MContext * c,
uint8_t * dst,
int stride )
static

Definition at line 1326 of file g2meet.c.

Referenced by g2m_decode_frame().

◆ g2m_decode_frame()

static int g2m_decode_frame ( AVCodecContext * avctx,
AVFrame * pic,
int * got_picture_ptr,
AVPacket * avpkt )
static

Definition at line 1375 of file g2meet.c.

◆ g2m_decode_init()

static av_cold int g2m_decode_init ( AVCodecContext * avctx)
static

Definition at line 1591 of file g2meet.c.

◆ g2m_decode_end()

static av_cold int g2m_decode_end ( AVCodecContext * avctx)
static

Definition at line 1610 of file g2meet.c.

Variable Documentation

◆ luma_quant

const uint8_t luma_quant[64]
static
Initial value:
= {
8, 6, 6, 7, 6, 5, 8, 7,
7, 7, 9, 9, 8, 10, 12, 20,
13, 12, 11, 11, 12, 25, 18, 19,
15, 20, 29, 26, 31, 30, 29, 26,
28, 28, 32, 36, 46, 39, 32, 34,
44, 35, 28, 28, 40, 55, 41, 44,
48, 49, 52, 52, 52, 31, 39, 57,
61, 56, 50, 60, 46, 51, 52, 50,
}

Definition at line 65 of file g2meet.c.

Referenced by jpg_decode_block().

◆ chroma_quant

const uint8_t chroma_quant[64]
static
Initial value:
= {
9, 9, 9, 12, 11, 12, 24, 13,
13, 24, 50, 33, 28, 33, 50, 50,
50, 50, 50, 50, 50, 50, 50, 50,
50, 50, 50, 50, 50, 50, 50, 50,
50, 50, 50, 50, 50, 50, 50, 50,
50, 50, 50, 50, 50, 50, 50, 50,
50, 50, 50, 50, 50, 50, 50, 50,
50, 50, 50, 50, 50, 50, 50, 50,
}

Definition at line 76 of file g2meet.c.

Referenced by jpg_decode_block().

◆ ff_g2m_decoder

const FFCodec ff_g2m_decoder
Initial value:
= {
.p.name = "g2m",
CODEC_LONG_NAME("Go2Meeting"),
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_G2M,
.priv_data_size = sizeof(G2MContext),
.p.capabilities = AV_CODEC_CAP_DR1,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
}
static av_cold void close(AVCodecParserContext *s)
Definition apv_parser.c:197
#define FF_CODEC_DECODE_CB(func)
#define CODEC_LONG_NAME(str)
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
static av_cold int g2m_decode_end(AVCodecContext *avctx)
Definition g2meet.c:1610
static int g2m_decode_frame(AVCodecContext *avctx, AVFrame *pic, int *got_picture_ptr, AVPacket *avpkt)
Definition g2meet.c:1375
static av_cold int g2m_decode_init(AVCodecContext *avctx)
Definition g2meet.c:1591
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition codec.h:49
@ AV_CODEC_ID_G2M
Definition codec_id.h:220
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200

Definition at line 1629 of file g2meet.c.