99
99
* @brief decode one rtjpeg YUV420 frame
100
* @param c context, must be initialized via rtjpeg_decode_init
100
* @param c context, must be initialized via ff_rtjpeg_decode_init
101
101
* @param f AVFrame to place decoded frame into. If parts of the frame
102
102
* are not coded they are left unchanged, so consider initializing it
103
103
* @param buf buffer containing input data
104
104
* @param buf_size length of input data in bytes
105
105
* @return number of bytes consumed from the input buffer
107
int rtjpeg_decode_frame_yuv420(RTJpegContext *c, AVFrame *f,
108
const uint8_t *buf, int buf_size) {
107
int ff_rtjpeg_decode_frame_yuv420(RTJpegContext *c, AVFrame *f,
108
const uint8_t *buf, int buf_size) {
109
109
GetBitContext gb;
110
110
int w = c->w / 16, h = c->h / 16;
112
112
uint8_t *y1 = f->data[0], *y2 = f->data[0] + 8 * f->linesize[0];
113
113
uint8_t *u = f->data[1], *v = f->data[2];
114
init_get_bits(&gb, buf, buf_size * 8);
115
if ((ret = init_get_bits8(&gb, buf, buf_size)) < 0)
115
118
for (y = 0; y < h; y++) {
116
119
for (x = 0; x < w; x++) {
117
120
#define BLOCK(quant, dst, stride) do { \
154
157
* @param lquant luma quantization table to use
155
158
* @param cquant chroma quantization table to use
157
void rtjpeg_decode_init(RTJpegContext *c, DSPContext *dsp,
158
int width, int height,
159
const uint32_t *lquant, const uint32_t *cquant) {
160
void ff_rtjpeg_decode_init(RTJpegContext *c, DSPContext *dsp,
161
int width, int height,
162
const uint32_t *lquant, const uint32_t *cquant) {
162
165
for (i = 0; i < 64; i++) {