mirror of https://git.ffmpeg.org/ffmpeg.git
Merge commit 'd509ae5be0a9bac35a4cedbe68b774a74446bb27'
* commit 'd509ae5be0a9bac35a4cedbe68b774a74446bb27': jvdec: K&R formatting cosmetics Conflicts: libavcodec/jvdec.c libavformat/jvdec.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
dcbc748ad1
|
@ -25,11 +25,12 @@
|
|||
* @author Peter Ross <pross@xvid.org>
|
||||
*/
|
||||
|
||||
#include "libavutil/intreadwrite.h"
|
||||
|
||||
#include "avcodec.h"
|
||||
#include "dsputil.h"
|
||||
#include "get_bits.h"
|
||||
#include "internal.h"
|
||||
#include "libavutil/intreadwrite.h"
|
||||
|
||||
typedef struct JvContext {
|
||||
DSPContext dsp;
|
||||
|
@ -62,19 +63,19 @@ static inline void decode2x2(GetBitContext *gb, uint8_t *dst, int linesize)
|
|||
case 1:
|
||||
v[0] = get_bits(gb, 8);
|
||||
for (j = 0; j < 2; j++)
|
||||
memset(dst + j*linesize, v[0], 2);
|
||||
memset(dst + j * linesize, v[0], 2);
|
||||
break;
|
||||
case 2:
|
||||
v[0] = get_bits(gb, 8);
|
||||
v[1] = get_bits(gb, 8);
|
||||
for (j = 0; j < 2; j++)
|
||||
for (i = 0; i < 2; i++)
|
||||
dst[j*linesize + i] = v[get_bits1(gb)];
|
||||
dst[j * linesize + i] = v[get_bits1(gb)];
|
||||
break;
|
||||
case 3:
|
||||
for (j = 0; j < 2; j++)
|
||||
for (i = 0; i < 2; i++)
|
||||
dst[j*linesize + i] = get_bits(gb, 8);
|
||||
dst[j * linesize + i] = get_bits(gb, 8);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -89,29 +90,30 @@ static inline void decode4x4(GetBitContext *gb, uint8_t *dst, int linesize)
|
|||
case 1:
|
||||
v[0] = get_bits(gb, 8);
|
||||
for (j = 0; j < 4; j++)
|
||||
memset(dst + j*linesize, v[0], 4);
|
||||
memset(dst + j * linesize, v[0], 4);
|
||||
break;
|
||||
case 2:
|
||||
v[0] = get_bits(gb, 8);
|
||||
v[1] = get_bits(gb, 8);
|
||||
for (j = 2; j >= 0; j -= 2) {
|
||||
for (i = 0; i < 4; i++)
|
||||
dst[j*linesize + i] = v[get_bits1(gb)];
|
||||
dst[j * linesize + i] = v[get_bits1(gb)];
|
||||
for (i = 0; i < 4; i++)
|
||||
dst[(j+1)*linesize + i] = v[get_bits1(gb)];
|
||||
dst[(j + 1) * linesize + i] = v[get_bits1(gb)];
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
for (j = 0; j < 4; j += 2)
|
||||
for (i = 0; i < 4; i += 2)
|
||||
decode2x2(gb, dst + j*linesize + i, linesize);
|
||||
decode2x2(gb, dst + j * linesize + i, linesize);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode 8x8 block
|
||||
*/
|
||||
static inline void decode8x8(GetBitContext *gb, uint8_t *dst, int linesize, DSPContext *dsp)
|
||||
static inline void decode8x8(GetBitContext *gb, uint8_t *dst, int linesize,
|
||||
DSPContext *dsp)
|
||||
{
|
||||
int i, j, v[2];
|
||||
|
||||
|
@ -125,17 +127,16 @@ static inline void decode8x8(GetBitContext *gb, uint8_t *dst, int linesize, DSPC
|
|||
v[1] = get_bits(gb, 8);
|
||||
for (j = 7; j >= 0; j--)
|
||||
for (i = 0; i < 8; i++)
|
||||
dst[j*linesize + i] = v[get_bits1(gb)];
|
||||
dst[j * linesize + i] = v[get_bits1(gb)];
|
||||
break;
|
||||
case 3:
|
||||
for (j = 0; j < 8; j += 4)
|
||||
for (i = 0; i < 8; i += 4)
|
||||
decode4x4(gb, dst + j*linesize + i, linesize);
|
||||
decode4x4(gb, dst + j * linesize + i, linesize);
|
||||
}
|
||||
}
|
||||
|
||||
static int decode_frame(AVCodecContext *avctx,
|
||||
void *data, int *got_frame,
|
||||
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
AVPacket *avpkt)
|
||||
{
|
||||
JvContext *s = avctx->priv_data;
|
||||
|
@ -164,16 +165,19 @@ static int decode_frame(AVCodecContext *avctx,
|
|||
|
||||
for (j = 0; j < avctx->height; j += 8)
|
||||
for (i = 0; i < avctx->width; i += 8)
|
||||
decode8x8(&gb, s->frame->data[0] + j * s->frame->linesize[0] + i,
|
||||
decode8x8(&gb,
|
||||
s->frame->data[0] + j * s->frame->linesize[0] + i,
|
||||
s->frame->linesize[0], &s->dsp);
|
||||
|
||||
buf += video_size;
|
||||
} else if (video_type == 2) {
|
||||
int v = *buf++;
|
||||
for (j = 0; j < avctx->height; j++)
|
||||
memset(s->frame->data[0] + j * s->frame->linesize[0], v, avctx->width);
|
||||
memset(s->frame->data[0] + j * s->frame->linesize[0],
|
||||
v, avctx->width);
|
||||
} else {
|
||||
av_log(avctx, AV_LOG_WARNING, "unsupported frame type %i\n", video_type);
|
||||
av_log(avctx, AV_LOG_WARNING,
|
||||
"unsupported frame type %i\n", video_type);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
#include "libavutil/channel_layout.h"
|
||||
#include "libavutil/intreadwrite.h"
|
||||
|
||||
#include "avformat.h"
|
||||
#include "internal.h"
|
||||
|
||||
|
@ -106,7 +107,8 @@ static int read_header(AVFormatContext *s)
|
|||
|
||||
avio_skip(pb, 10);
|
||||
|
||||
ast->index_entries = av_malloc(ast->nb_index_entries * sizeof(*ast->index_entries));
|
||||
ast->index_entries = av_malloc(ast->nb_index_entries *
|
||||
sizeof(*ast->index_entries));
|
||||
if (!ast->index_entries)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
|
@ -115,7 +117,7 @@ static int read_header(AVFormatContext *s)
|
|||
return AVERROR(ENOMEM);
|
||||
|
||||
offset = 0x68 + ast->nb_index_entries * 16;
|
||||
for(i = 0; i < ast->nb_index_entries; i++) {
|
||||
for (i = 0; i < ast->nb_index_entries; i++) {
|
||||
AVIndexEntry *e = ast->index_entries + i;
|
||||
JVFrame *jvf = jv->frames + i;
|
||||
|
||||
|
@ -168,10 +170,10 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
|
|||
const AVIndexEntry *e = ast->index_entries + jv->pts;
|
||||
const JVFrame *jvf = jv->frames + jv->pts;
|
||||
|
||||
switch(jv->state) {
|
||||
switch (jv->state) {
|
||||
case JV_AUDIO:
|
||||
jv->state++;
|
||||
if (jvf->audio_size ) {
|
||||
if (jvf->audio_size) {
|
||||
if (av_get_packet(s->pb, pkt, jvf->audio_size) < 0)
|
||||
return AVERROR(ENOMEM);
|
||||
pkt->stream_index = 0;
|
||||
|
@ -220,10 +222,10 @@ static int read_seek(AVFormatContext *s, int stream_index,
|
|||
AVStream *ast = s->streams[0];
|
||||
int i;
|
||||
|
||||
if (flags & (AVSEEK_FLAG_BYTE|AVSEEK_FLAG_FRAME))
|
||||
if (flags & (AVSEEK_FLAG_BYTE | AVSEEK_FLAG_FRAME))
|
||||
return AVERROR(ENOSYS);
|
||||
|
||||
switch(stream_index) {
|
||||
switch (stream_index) {
|
||||
case 0:
|
||||
i = av_index_search_timestamp(ast, ts, flags);
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue