mom_access.c
上传用户:hxb_1234
上传日期:2010-03-30
资源大小:8328k
文件大小:6k
源码类别:

VC书籍

开发平台:

Visual C++

  1. #include "mom_access.h"
  2. Char *
  3. GetImageData(Image *image)
  4. {
  5. switch(GetImageType(image))
  6. {
  7. case SHORT_TYPE:
  8. return((Char *)image->data->s);
  9. break;
  10. case FLOAT_TYPE:
  11. return((Char *)image->data->f);
  12. break;
  13. case UCHAR_TYPE:
  14. return((Char *)image->data->u);
  15. break;
  16. default:
  17. printf("Image type >>%d<< not supportedn",image->type);
  18. return(NULL);
  19. }
  20. }
  21. UInt
  22. GetImageSize(Image *image)
  23. {
  24. return(image->x * image->y);
  25. }
  26. UInt
  27. GetImageSizeX(Image *image)
  28. {
  29. return(image->x);
  30. }
  31. UInt
  32. GetImageSizeY(Image *image)
  33. {
  34. return(image->y);
  35. }
  36. Int
  37. GetImageVersion(Image *image)
  38. {
  39. return(image->version);
  40. }
  41. ImageType
  42. GetImageType(Image *image)
  43. {
  44. return(image->type);
  45. }
  46. Int GetVopNot8Bit(Vop *vop)
  47. {
  48. return (vop->bits_per_pixel != 8);
  49. }
  50. Int GetVopQuantPrecision(Vop *vop)
  51. {
  52. return (vop->quant_precision);
  53. }
  54. Int GetVopBitsPerPixel(Vop *vop)
  55. {
  56. return (vop->bits_per_pixel);
  57. }
  58. Int GetVopMidGrey(Vop *vop)
  59. {
  60. return (1 << (vop->bits_per_pixel - 1));
  61. }
  62. Int GetVopBrightWhite(Vop *vop)
  63. {
  64. return ((1 << vop->bits_per_pixel) - 1);
  65. }
  66. Int GetVopTimeIncrementResolution(Vop *vop)
  67. {
  68. return (vop->time_increment_resolution);
  69. }
  70. Int
  71. GetVopModTimeBase(Vop *vop)
  72. {
  73. return(vop->mod_time_base);
  74. }
  75. Int
  76. GetVopTimeInc(Vop *vop)
  77. {
  78. return((int)vop->time_inc);
  79. }
  80. Int
  81. GetVopPredictionType(Vop *vop)
  82. {
  83. return(vop->prediction_type);
  84. }
  85. Int GetVopIntraDCVlcThr(Vop *vop)
  86. {
  87. return (vop->intra_dc_vlc_thr);
  88. }
  89. Int
  90. GetVopRoundingType(Vop *vop)
  91. {
  92. return(vop->rounding_type);
  93. }
  94. Int
  95. GetVopWidth(Vop *vop)
  96. {
  97. return(vop->width);
  98. }
  99. Int
  100. GetVopHeight(Vop *vop)
  101. {
  102. return(vop->height);
  103. }
  104. Int
  105. GetVopHorSpatRef(Vop *vop)
  106. {
  107. return(vop->hor_spat_ref);
  108. }
  109. Int
  110. GetVopVerSpatRef(Vop *vop)
  111. {
  112. return(vop->ver_spat_ref);
  113. }
  114. Int
  115. GetVopQuantizer(Vop *vop)
  116. {
  117. return(vop->quantizer);
  118. }
  119. Int
  120. GetVopIntraQuantizer(Vop *vop)
  121. {
  122. return(vop->intra_quantizer);
  123. }
  124. Int
  125. GetVopIntraACDCPredDisable(Vop *vop)
  126. {
  127. return(vop->intra_acdc_pred_disable);
  128. }
  129. Int
  130. GetVopFCodeFor(Vop *vop)
  131. {
  132. return(vop->fcode_for);
  133. }
  134. Int
  135. GetVopSearchRangeFor(Vop *vop)
  136. {
  137. return(vop->sr_for);
  138. }
  139. Image *
  140. GetVopY(Vop *vop)
  141. {
  142. return(vop->y_chan);
  143. }
  144. Image *
  145. GetVopU(Vop *vop)
  146. {
  147. return(vop->u_chan);
  148. }
  149. Image *
  150. GetVopV(Vop *vop)
  151. {
  152. return(vop->v_chan);
  153. }
  154. Void PutVopQuantPrecision(Int quant_precision,Vop *vop)
  155. {
  156. vop->quant_precision = quant_precision;
  157. }
  158. Void PutVopBitsPerPixel(Int bits_per_pixel,Vop *vop)
  159. {
  160. vop->bits_per_pixel = bits_per_pixel;
  161. }
  162. Void PutVopTimeIncrementResolution(Int time_incre_res, Vop *vop)
  163. {
  164. vop->time_increment_resolution=time_incre_res;
  165. }
  166. Void
  167. PutVopModTimeBase(Int mod_time_base, Vop *vop)
  168. {
  169. vop->mod_time_base = mod_time_base;
  170. }
  171. Void
  172. PutVopTimeInc(Int time_inc, Vop *vop)
  173. {
  174. vop->time_inc = (float)time_inc;
  175. }
  176. Void
  177. PutVopPredictionType(Int prediction_type, Vop *vop)
  178. {
  179. vop->prediction_type = prediction_type;
  180. }
  181. Void PutVopIntraDCVlcThr(Int intra_dc_vlc_thr,Vop *vop)
  182. {
  183. vop->intra_dc_vlc_thr=intra_dc_vlc_thr;
  184. }
  185. Void
  186. PutVopRoundingType(Int rounding_type, Vop *vop)
  187. {
  188. vop->rounding_type = rounding_type;
  189. }
  190. Void
  191. PutVopWidth(Int width, Vop *vop)
  192. {
  193. vop->width = width;
  194. }
  195. Void
  196. PutVopHeight(Int height, Vop *vop)
  197. {
  198. vop->height = height;
  199. }
  200. Void
  201. PutVopHorSpatRef(Int hor_spat_ref, Vop *vop)
  202. {
  203. vop->hor_spat_ref = hor_spat_ref;
  204. }
  205. Void
  206. PutVopVerSpatRef(Int ver_spat_ref, Vop *vop)
  207. {
  208. vop->ver_spat_ref = ver_spat_ref;
  209. }
  210. Void
  211. PutVopQuantizer(Int quantizer, Vop *vop)
  212. {
  213. vop->quantizer = quantizer;
  214. }
  215. Void
  216. PutVopIntraACDCPredDisable(Int intra_acdc_pred_disable, Vop *vop)
  217. {
  218. vop->intra_acdc_pred_disable = intra_acdc_pred_disable;
  219. }
  220. Void
  221. PutVopFCodeFor(Int fcode_for, Vop *vop)
  222. {
  223. vop->fcode_for = fcode_for;
  224. }
  225. Void
  226. PutVopSearchRangeFor(Int sr_for, Vop *vop)
  227. {
  228. vop->sr_for = sr_for;
  229. }
  230. Void
  231. PutVopY(Image *y_chan, Vop *vop)
  232. {
  233. FreeImage(vop->y_chan);
  234. vop->y_chan = y_chan;
  235. }
  236. Void
  237. PutVopU(Image *u_chan, Vop *vop)
  238. {
  239. FreeImage(vop->u_chan);
  240. vop->u_chan = u_chan;
  241. }
  242. Void
  243. PutVopV(Image *v_chan, Vop *vop)
  244. {
  245. FreeImage(vop->v_chan);
  246. vop->v_chan = v_chan;
  247. }
  248. Void
  249. PutVopIntraQuantizer(Int Q,Vop *vop)
  250. {
  251. vop->intra_quantizer = Q;
  252. }
  253. Void
  254. PutVolConfigFrameRate(Float fr, VolConfig *cfg)
  255. {
  256. cfg->frame_rate = fr;
  257. }
  258. Void
  259. PutVolConfigM(Int M, VolConfig *cfg)
  260. {
  261. cfg->M = M;
  262. }
  263. Void
  264. PutVolConfigStartFrame(Int frame, VolConfig *cfg)
  265. {
  266. cfg->start_frame = frame;
  267. }
  268. Void
  269. PutVolConfigEndFrame(Int frame, VolConfig *cfg)
  270. {
  271. cfg->end_frame = frame;
  272. }
  273. Void
  274. PutVolConfigBitrate(Int bit_rate,VolConfig *cfg)
  275. {
  276. cfg->bit_rate = bit_rate;
  277. }
  278. Void
  279. PutVolConfigIntraPeriod(Int ir,VolConfig *cfg)
  280. {
  281. cfg->intra_period = ir;
  282. }
  283. Void
  284. PutVolConfigQuantizer(Int Q,VolConfig *cfg)
  285. {
  286. cfg->quantizer = Q;
  287. }
  288. Void
  289. PutVolConfigIntraQuantizer(Int Q,VolConfig *cfg)
  290. {
  291. cfg->intra_quantizer = Q;
  292. }
  293. Void
  294. PutVolConfigFrameSkip(Int frame_skip,VolConfig *cfg)
  295. {
  296. cfg->frame_skip = frame_skip;
  297. }
  298. Void
  299. PutVolConfigModTimeBase(Int time,VolConfig *cfg)
  300. {
  301. cfg->modulo_time_base[0] = cfg->modulo_time_base[1];
  302. cfg->modulo_time_base[1] = time;
  303. }
  304. Float
  305. GetVolConfigFrameRate(VolConfig *cfg)
  306. {
  307. return(cfg->frame_rate);
  308. }
  309. Int
  310. GetVolConfigM(VolConfig *cfg)
  311. {
  312. return(cfg->M);
  313. }
  314. Int
  315. GetVolConfigStartFrame(VolConfig *cfg)
  316. {
  317. return(cfg->start_frame);
  318. }
  319. Int
  320. GetVolConfigEndFrame(VolConfig *cfg)
  321. {
  322. return(cfg->end_frame);
  323. }
  324. Int
  325. GetVolConfigBitrate(VolConfig *cfg)
  326. {
  327. return(cfg->bit_rate);
  328. }
  329. Int
  330. GetVolConfigIntraPeriod(VolConfig *cfg)
  331. {
  332. return(cfg->intra_period);
  333. }
  334. Int
  335. GetVolConfigQuantizer(VolConfig *cfg)
  336. {
  337. return(cfg->quantizer);
  338. }
  339. Int
  340. GetVolConfigIntraQuantizer(VolConfig *cfg)
  341. {
  342. return(cfg->intra_quantizer);
  343. }
  344. Int
  345. GetVolConfigFrameSkip(VolConfig *cfg)
  346. {
  347. return(cfg->frame_skip);
  348. }
  349. Int
  350. GetVolConfigModTimeBase(VolConfig *cfg,Int i)
  351. {
  352. return(cfg->modulo_time_base[i]);
  353. }