Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 366789
b: refs/heads/master
c: 35d2d76
h: refs/heads/master
i:
  366787: e4b7dff
v: v3
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed Mar 24, 2013
1 parent 6549605 commit df36b34
Show file tree
Hide file tree
Showing 6 changed files with 182 additions and 508 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 50deb74905d1e123878f50ed31f829916b936ded
refs/heads/master: 35d2d76dbeb6075dc629f3592bae304db81579ce
16 changes: 8 additions & 8 deletions trunk/drivers/staging/media/go7007/go7007-driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -433,12 +433,12 @@ void go7007_parse_video_stream(struct go7007 *go, u8 *buf, int length)
spin_lock(&go->spinlock);

switch (go->format) {
case GO7007_FORMAT_MPEG4:
case V4L2_PIX_FMT_MPEG4:
seq_start_code = 0xB0;
frame_start_code = 0xB6;
break;
case GO7007_FORMAT_MPEG1:
case GO7007_FORMAT_MPEG2:
case V4L2_PIX_FMT_MPEG1:
case V4L2_PIX_FMT_MPEG2:
seq_start_code = 0xB3;
frame_start_code = 0x00;
break;
Expand Down Expand Up @@ -518,9 +518,9 @@ void go7007_parse_video_stream(struct go7007 *go, u8 *buf, int length)
}
/* If this is the start of a new MPEG frame,
* get a new buffer */
if ((go->format == GO7007_FORMAT_MPEG1 ||
go->format == GO7007_FORMAT_MPEG2 ||
go->format == GO7007_FORMAT_MPEG4) &&
if ((go->format == V4L2_PIX_FMT_MPEG1 ||
go->format == V4L2_PIX_FMT_MPEG2 ||
go->format == V4L2_PIX_FMT_MPEG4) &&
(buf[i] == seq_start_code ||
buf[i] == 0xB8 || /* GOP code */
buf[i] == frame_start_code)) {
Expand Down Expand Up @@ -577,7 +577,7 @@ void go7007_parse_video_stream(struct go7007 *go, u8 *buf, int length)
/* go->state remains STATE_FF */
break;
case 0xD8:
if (go->format == GO7007_FORMAT_MJPEG)
if (go->format == V4L2_PIX_FMT_MJPEG)
frame_boundary(go);
/* fall through */
default:
Expand Down Expand Up @@ -654,8 +654,8 @@ struct go7007 *go7007_alloc(struct go7007_board_info *board, struct device *dev)
go->encoder_h_halve = 0;
go->encoder_v_halve = 0;
go->encoder_subsample = 0;
go->format = V4L2_PIX_FMT_MJPEG;
go->streaming = 0;
go->format = GO7007_FORMAT_MJPEG;
go->bitrate = 1500000;
go->fps_scale = 1;
go->pali = 0;
Expand Down
78 changes: 39 additions & 39 deletions trunk/drivers/staging/media/go7007/go7007-fw.c
Original file line number Diff line number Diff line change
Expand Up @@ -455,9 +455,9 @@ static int mpeg1_frame_header(struct go7007 *go, unsigned char *buf,

CODE_ADD(c, frame == PFRAME ? 0x2 : 0x3, 13);
CODE_ADD(c, 0xffff, 16);
CODE_ADD(c, go->format == GO7007_FORMAT_MPEG2 ? 0x7 : 0x4, 4);
CODE_ADD(c, go->format == V4L2_PIX_FMT_MPEG2 ? 0x7 : 0x4, 4);
if (frame != PFRAME)
CODE_ADD(c, go->format == GO7007_FORMAT_MPEG2 ? 0x7 : 0x4, 4);
CODE_ADD(c, go->format == V4L2_PIX_FMT_MPEG2 ? 0x7 : 0x4, 4);
else
CODE_ADD(c, 0, 4); /* Is this supposed to be here?? */
CODE_ADD(c, 0, 3); /* What is this?? */
Expand All @@ -466,7 +466,7 @@ static int mpeg1_frame_header(struct go7007 *go, unsigned char *buf,
if (j != 8)
CODE_ADD(c, 0, j);

if (go->format == GO7007_FORMAT_MPEG2) {
if (go->format == V4L2_PIX_FMT_MPEG2) {
CODE_ADD(c, 0x1, 24);
CODE_ADD(c, 0xb5, 8);
CODE_ADD(c, 0x844, 12);
Expand Down Expand Up @@ -537,7 +537,7 @@ static int mpeg1_sequence_header(struct go7007 *go, unsigned char *buf, int ext)
int i, aspect_ratio, picture_rate;
CODE_GEN(c, buf + 6);

if (go->format == GO7007_FORMAT_MPEG1) {
if (go->format == V4L2_PIX_FMT_MPEG1) {
switch (go->aspect_ratio) {
case GO7007_RATIO_4_3:
aspect_ratio = go->standard == GO7007_STD_NTSC ? 3 : 2;
Expand Down Expand Up @@ -587,17 +587,17 @@ static int mpeg1_sequence_header(struct go7007 *go, unsigned char *buf, int ext)
CODE_ADD(c, go->height, 12);
CODE_ADD(c, aspect_ratio, 4);
CODE_ADD(c, picture_rate, 4);
CODE_ADD(c, go->format == GO7007_FORMAT_MPEG2 ? 20000 : 0x3ffff, 18);
CODE_ADD(c, go->format == V4L2_PIX_FMT_MPEG2 ? 20000 : 0x3ffff, 18);
CODE_ADD(c, 1, 1);
CODE_ADD(c, go->format == GO7007_FORMAT_MPEG2 ? 112 : 20, 10);
CODE_ADD(c, go->format == V4L2_PIX_FMT_MPEG2 ? 112 : 20, 10);
CODE_ADD(c, 0, 3);

/* Byte-align with zeros */
i = 8 - (CODE_LENGTH(c) % 8);
if (i != 8)
CODE_ADD(c, 0, i);

if (go->format == GO7007_FORMAT_MPEG2) {
if (go->format == V4L2_PIX_FMT_MPEG2) {
CODE_ADD(c, 0x1, 24);
CODE_ADD(c, 0xb5, 8);
CODE_ADD(c, 0x148, 12);
Expand Down Expand Up @@ -930,10 +930,10 @@ static int brctrl_to_package(struct go7007 *go,
__le16 *code, int space, int *framelen)
{
int converge_speed = 0;
int lambda = (go->format == GO7007_FORMAT_MJPEG || go->dvd_mode) ?
int lambda = (go->format == V4L2_PIX_FMT_MJPEG || go->dvd_mode) ?
100 : 0;
int peak_rate = 6 * go->bitrate / 5;
int vbv_buffer = go->format == GO7007_FORMAT_MJPEG ?
int vbv_buffer = go->format == V4L2_PIX_FMT_MJPEG ?
go->bitrate :
(go->dvd_mode ? 900000 : peak_rate);
int fps = go->sensor_framerate / go->fps_scale;
Expand Down Expand Up @@ -1096,10 +1096,10 @@ static int config_package(struct go7007 *go, __le16 *code, int space)
0xc003, 0x28b4,
0xc004, 0x3c5a,
0xdc05, 0x2a77,
0xc6c3, go->format == GO7007_FORMAT_MPEG4 ? 0 :
(go->format == GO7007_FORMAT_H263 ? 0 : 1),
0xc680, go->format == GO7007_FORMAT_MPEG4 ? 0xf1 :
(go->format == GO7007_FORMAT_H263 ? 0x61 :
0xc6c3, go->format == V4L2_PIX_FMT_MPEG4 ? 0 :
(go->format == V4L2_PIX_FMT_H263 ? 0 : 1),
0xc680, go->format == V4L2_PIX_FMT_MPEG4 ? 0xf1 :
(go->format == V4L2_PIX_FMT_H263 ? 0x61 :
0xd3),
0xc780, 0x0140,
0xe009, 0x0001,
Expand All @@ -1123,15 +1123,15 @@ static int config_package(struct go7007 *go, __le16 *code, int space)
(!go->interlace_coding) ?
0x0008 : 0x0009,
0xc404, go->interlace_coding ? 0x44 :
(go->format == GO7007_FORMAT_MPEG4 ? 0x11 :
(go->format == GO7007_FORMAT_MPEG1 ? 0x02 :
(go->format == GO7007_FORMAT_MPEG2 ? 0x04 :
(go->format == GO7007_FORMAT_H263 ? 0x08 :
(go->format == V4L2_PIX_FMT_MPEG4 ? 0x11 :
(go->format == V4L2_PIX_FMT_MPEG1 ? 0x02 :
(go->format == V4L2_PIX_FMT_MPEG2 ? 0x04 :
(go->format == V4L2_PIX_FMT_H263 ? 0x08 :
0x20)))),
0xbf0a, (go->format == GO7007_FORMAT_MPEG4 ? 8 :
(go->format == GO7007_FORMAT_MPEG1 ? 1 :
(go->format == GO7007_FORMAT_MPEG2 ? 2 :
(go->format == GO7007_FORMAT_H263 ? 4 : 16)))) |
0xbf0a, (go->format == V4L2_PIX_FMT_MPEG4 ? 8 :
(go->format == V4L2_PIX_FMT_MPEG1 ? 1 :
(go->format == V4L2_PIX_FMT_MPEG2 ? 2 :
(go->format == V4L2_PIX_FMT_H263 ? 4 : 16)))) |
((go->repeat_seqhead ? 1 : 0) << 6) |
((go->dvd_mode ? 1 : 0) << 9) |
((go->gop_header_enable ? 1 : 0) << 10),
Expand Down Expand Up @@ -1348,19 +1348,19 @@ static int final_package(struct go7007 *go, __le16 *code, int space)
0x41,
go->ipb ? 0xd4c : 0x36b,
(rows << 8) | (go->width >> 4),
go->format == GO7007_FORMAT_MPEG4 ? 0x0404 : 0,
go->format == V4L2_PIX_FMT_MPEG4 ? 0x0404 : 0,
(1 << 15) | ((go->interlace_coding ? 1 : 0) << 13) |
((go->closed_gop ? 1 : 0) << 12) |
((go->format == GO7007_FORMAT_MPEG4 ? 1 : 0) << 11) |
((go->format == V4L2_PIX_FMT_MPEG4 ? 1 : 0) << 11) |
/* (1 << 9) | */
((go->ipb ? 3 : 0) << 7) |
((go->modet_enable ? 1 : 0) << 2) |
((go->dvd_mode ? 1 : 0) << 1) | 1,
(go->format == GO7007_FORMAT_MPEG1 ? 0x89a0 :
(go->format == GO7007_FORMAT_MPEG2 ? 0x89a0 :
(go->format == GO7007_FORMAT_MJPEG ? 0x89a0 :
(go->format == GO7007_FORMAT_MPEG4 ? 0x8920 :
(go->format == GO7007_FORMAT_H263 ? 0x8920 : 0))))),
(go->format == V4L2_PIX_FMT_MPEG1 ? 0x89a0 :
(go->format == V4L2_PIX_FMT_MPEG2 ? 0x89a0 :
(go->format == V4L2_PIX_FMT_MJPEG ? 0x89a0 :
(go->format == V4L2_PIX_FMT_MPEG4 ? 0x8920 :
(go->format == V4L2_PIX_FMT_H263 ? 0x8920 : 0))))),
go->ipb ? 0x1f15 : 0x1f0b,
go->ipb ? 0x0015 : 0x000b,
go->ipb ? 0xa800 : 0x5800,
Expand Down Expand Up @@ -1503,13 +1503,13 @@ static int do_special(struct go7007 *go, u16 type, __le16 *code, int space,
switch (type) {
case SPECIAL_FRM_HEAD:
switch (go->format) {
case GO7007_FORMAT_MJPEG:
case V4L2_PIX_FMT_MJPEG:
return gen_mjpeghdr_to_package(go, code, space);
case GO7007_FORMAT_MPEG1:
case GO7007_FORMAT_MPEG2:
case V4L2_PIX_FMT_MPEG1:
case V4L2_PIX_FMT_MPEG2:
return gen_mpeg1hdr_to_package(go, code, space,
framelen);
case GO7007_FORMAT_MPEG4:
case V4L2_PIX_FMT_MPEG4:
return gen_mpeg4hdr_to_package(go, code, space,
framelen);
}
Expand All @@ -1519,11 +1519,11 @@ static int do_special(struct go7007 *go, u16 type, __le16 *code, int space,
return config_package(go, code, space);
case SPECIAL_SEQHEAD:
switch (go->format) {
case GO7007_FORMAT_MPEG1:
case GO7007_FORMAT_MPEG2:
case V4L2_PIX_FMT_MPEG1:
case V4L2_PIX_FMT_MPEG2:
return seqhead_to_package(go, code, space,
mpeg1_sequence_header);
case GO7007_FORMAT_MPEG4:
case V4L2_PIX_FMT_MPEG4:
return seqhead_to_package(go, code, space,
mpeg4_sequence_header);
default:
Expand Down Expand Up @@ -1553,16 +1553,16 @@ int go7007_construct_fw_image(struct go7007 *go, u8 **fw, int *fwlen)
int ret;

switch (go->format) {
case GO7007_FORMAT_MJPEG:
case V4L2_PIX_FMT_MJPEG:
mode_flag = FLAG_MODE_MJPEG;
break;
case GO7007_FORMAT_MPEG1:
case V4L2_PIX_FMT_MPEG1:
mode_flag = FLAG_MODE_MPEG1;
break;
case GO7007_FORMAT_MPEG2:
case V4L2_PIX_FMT_MPEG2:
mode_flag = FLAG_MODE_MPEG2;
break;
case GO7007_FORMAT_MPEG4:
case V4L2_PIX_FMT_MPEG4:
mode_flag = FLAG_MODE_MPEG4;
break;
default:
Expand Down
13 changes: 6 additions & 7 deletions trunk/drivers/staging/media/go7007/go7007-priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,6 @@ struct go7007_file {
struct go7007_buffer *bufs;
};

#define GO7007_FORMAT_MJPEG 0
#define GO7007_FORMAT_MPEG4 1
#define GO7007_FORMAT_MPEG1 2
#define GO7007_FORMAT_MPEG2 3
#define GO7007_FORMAT_H263 4

#define GO7007_RATIO_1_1 0
#define GO7007_RATIO_4_3 1
#define GO7007_RATIO_16_9 2
Expand Down Expand Up @@ -186,6 +180,11 @@ struct go7007 {
unsigned boot_fw_len;
struct v4l2_device v4l2_dev;
struct v4l2_ctrl_handler hdl;
struct v4l2_ctrl *mpeg_video_encoding;
struct v4l2_ctrl *mpeg_video_gop_size;
struct v4l2_ctrl *mpeg_video_gop_closure;
struct v4l2_ctrl *mpeg_video_bitrate;
struct v4l2_ctrl *mpeg_video_aspect_ratio;
enum { STATUS_INIT, STATUS_ONLINE, STATUS_SHUTDOWN } status;
spinlock_t spinlock;
struct mutex hw_lock;
Expand All @@ -211,7 +210,7 @@ struct go7007 {
unsigned int encoder_subsample:1;

/* Encoder config */
int format;
u32 format;
int bitrate;
int fps_scale;
int pali;
Expand Down
Loading

0 comments on commit df36b34

Please sign in to comment.